mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #9992 from pakdel/issue-9932
Fixed Issue #9932: Only the first git repository is initialized and working using git_pillar
This commit is contained in:
commit
1a0581c8fd
@ -195,12 +195,11 @@ class Master(SMaster):
|
||||
ckminions = salt.utils.minions.CkMinions(self.opts)
|
||||
event = salt.utils.event.MasterEvent(self.opts['sock_dir'])
|
||||
|
||||
pillargitfs = None
|
||||
pillargitfs = []
|
||||
for opts_dict in [x for x in self.opts.get('ext_pillar', [])]:
|
||||
if 'git' in opts_dict:
|
||||
br, loc = opts_dict['git'].strip().split()
|
||||
pillargitfs = git_pillar.GitPillar(br, loc, self.opts)
|
||||
break
|
||||
pillargitfs.append(git_pillar.GitPillar(br, loc, self.opts))
|
||||
|
||||
old_present = set()
|
||||
while True:
|
||||
@ -248,8 +247,8 @@ class Master(SMaster):
|
||||
salt.utils.verify.check_max_open_files(self.opts)
|
||||
|
||||
try:
|
||||
if pillargitfs is not None:
|
||||
pillargitfs.update()
|
||||
for pillargit in pillargitfs:
|
||||
pillargit.update()
|
||||
except Exception as exc:
|
||||
log.error('Exception {0} occurred in file server update '
|
||||
'for git_pillar module.'.format(exc))
|
||||
|
@ -341,10 +341,18 @@ class Pillar(object):
|
||||
errors = []
|
||||
fn_ = self.client.get_state(sls, saltenv).get('dest', False)
|
||||
if not fn_:
|
||||
msg = ('Specified SLS {0!r} in environment {1!r} is not'
|
||||
' available on the salt master').format(sls, saltenv)
|
||||
log.error(msg)
|
||||
errors.append(msg)
|
||||
if self.opts['pillar_roots'].get(saltenv):
|
||||
msg = ('Specified SLS {0!r} in environment {1!r} is not'
|
||||
' available on the salt master').format(sls, saltenv)
|
||||
log.error(msg)
|
||||
errors.append(msg)
|
||||
else:
|
||||
log.debug('Specified SLS {0!r} in environment {1!r} is not'
|
||||
' found, which might be due to environment {1!r}'
|
||||
' not being present in "pillar_roots" yet!'
|
||||
.format(sls, saltenv))
|
||||
# return state, mods, errors
|
||||
return None, mods, errors
|
||||
state = None
|
||||
try:
|
||||
state = compile_template(
|
||||
|
@ -217,10 +217,12 @@ def ext_pillar(minion_id, pillar, repo_string):
|
||||
if __opts__['pillar_roots'].get(branch, []) == [gitpil.working_dir]:
|
||||
return {}
|
||||
|
||||
gitpil.update()
|
||||
|
||||
opts = deepcopy(__opts__)
|
||||
|
||||
opts['pillar_roots'][branch] = [gitpil.working_dir]
|
||||
|
||||
pil = Pillar(opts, __grains__, minion_id, 'base')
|
||||
pil = Pillar(opts, __grains__, minion_id, branch)
|
||||
|
||||
return pil.compile_pillar()
|
||||
|
Loading…
Reference in New Issue
Block a user