Skip to content

Instantly share code, notes, and snippets.

@jvblasco
Created May 18, 2015 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvblasco/df3d72f4d8d2557e0a30 to your computer and use it in GitHub Desktop.
Save jvblasco/df3d72f4d8d2557e0a30 to your computer and use it in GitHub Desktop.
#!py
import yaml
def run():
config = yaml.load(file('/srv/pillar/common/nginx.sls', 'r'))
name = {'server_name': 'another-salt-test.com'}
root = {'root': '/var/www/another-salt-test.com/current/web'}
config['nginx']['ng']['server']['config']['worker_processes'] = __grains__['num_cpus']
config['nginx']['ng']['vhosts']['managed']['production']['config'][0]['server'].insert(1, name)
config['nginx']['ng']['vhosts']['managed']['production']['config'][0]['server'].insert(2, root)
mysql = {'lookup': {'server': 'Percona-Server-server-56',
'client': 'Percona-Server-client-56',
'service': 'mysql',
'python': 'MySQL-python',
}
}
config['mysql'] = mysql
return config
[ERROR ] Error in function _pillar:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1458, in run_func
ret = getattr(self, func)(load)
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1214, in _pillar
pillar = salt.pillar.Pillar(
AttributeError: 'dict' object has no attribute 'Pillar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment