Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Properly merge grains from cloud.profiles and cloud.map
Browse files Browse the repository at this point in the history
  • Loading branch information
techhat committed Sep 17, 2012
1 parent facd39e commit 3c73e18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions saltcloud/cloud.py
Expand Up @@ -192,8 +192,7 @@ def read(self):
Read in the specified map file and return the map structure
'''
if not self.opts['map']:
sys.stderr.write('A map file was not specified\n')
sys.exit(1)
return {}
if not os.path.isfile(self.opts['map']):
sys.stderr.write('The specified map file does not exist: {0}\n'.format(self.opts['map']))
sys.exit(1)
Expand Down Expand Up @@ -261,7 +260,8 @@ def run_map(self):
tvm['name'] = name
for miniondict in self.map[tvm['profile']]:
if name in miniondict:
tvm['grains'] = miniondict[name]
tvm['map_grains'] = miniondict[name]['grains']
tvm['map_minion'] = miniondict[name]['minion']
if self.opts['parallel']:
multiprocessing.Process(
target=lambda: self.create(tvm)
Expand Down
6 changes: 4 additions & 2 deletions saltcloud/utils/__init__.py
Expand Up @@ -105,8 +105,10 @@ def minion_conf_string(opts, vm_):
minion = {'id': vm_['name']}
minion.update(opts.get('minion', {}))
minion.update(vm_.get('minion', {}))
minion.update(opts.get('grains', {}))
minion.update(vm_.get('grains', {}))
minion.update(opts.get('map_minion', {}))
minion.update(vm_.get('map_minion', {}))
minion['grains'].update(opts.get('map_grains', {}))
minion['grains'].update(vm_.get('map_grains', {}))
return yaml.safe_dump(minion)


Expand Down

0 comments on commit 3c73e18

Please sign in to comment.