mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
salt-ssh state: fix including all salt:// references
Fixes #23355 - recursive look into each chunk of state (salt_refs) - don't break after including the first file of the list (prep_trans_tar)
This commit is contained in:
parent
a123a36f05
commit
d0549e56ba
@ -99,20 +99,20 @@ def lowstate_file_refs(chunks, extras=''):
|
||||
return refs
|
||||
|
||||
|
||||
def salt_refs(data):
|
||||
def salt_refs(data, ret=[]):
|
||||
'''
|
||||
Pull salt file references out of the states
|
||||
'''
|
||||
proto = 'salt://'
|
||||
ret = []
|
||||
if isinstance(data, str):
|
||||
if data.startswith(proto):
|
||||
return [data]
|
||||
if data.startswith(proto) and data not in ret:
|
||||
ret.append(data)
|
||||
if isinstance(data, list):
|
||||
for comp in data:
|
||||
if isinstance(comp, str):
|
||||
if comp.startswith(proto):
|
||||
ret.append(comp)
|
||||
salt_refs(comp, ret)
|
||||
if isinstance(data, dict):
|
||||
for comp in data:
|
||||
salt_refs(data[comp], ret)
|
||||
return ret
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ def prep_trans_tar(file_client, chunks, file_refs, pillar=None):
|
||||
if not os.path.isdir(tgt_dir):
|
||||
os.makedirs(tgt_dir)
|
||||
shutil.copy(path, tgt)
|
||||
break
|
||||
continue
|
||||
files = file_client.cache_dir(name, saltenv)
|
||||
if files:
|
||||
for filename in files:
|
||||
@ -170,7 +170,7 @@ def prep_trans_tar(file_client, chunks, file_refs, pillar=None):
|
||||
if not os.path.isdir(tgt_dir):
|
||||
os.makedirs(tgt_dir)
|
||||
shutil.copy(filename, tgt)
|
||||
break
|
||||
continue
|
||||
cwd = os.getcwd()
|
||||
os.chdir(gendir)
|
||||
with closing(tarfile.open(trans_tar, 'w:gz')) as tfp:
|
||||
|
Loading…
Reference in New Issue
Block a user