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