mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Different path to the static grains file when running under a proxy minion
Similarly to the changes from #44549, we need to look under in a different location when saving the static grains, so the grain file is, e.g., /etc/salt/proxy.d/{id}/grains. This solves #42300.
This commit is contained in:
parent
3eec8dbc63
commit
655139d01c
@ -229,20 +229,44 @@ def setvals(grains, destructive=False):
|
||||
raise SaltException('setvals grains must be a dictionary.')
|
||||
grains = {}
|
||||
if os.path.isfile(__opts__['conf_file']):
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'grains'
|
||||
)
|
||||
if salt.utils.is_proxy():
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'proxy.d',
|
||||
__opts__['id'],
|
||||
'grains'
|
||||
)
|
||||
else:
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'grains'
|
||||
)
|
||||
elif os.path.isdir(__opts__['conf_file']):
|
||||
gfn = os.path.join(
|
||||
__opts__['conf_file'],
|
||||
'grains'
|
||||
)
|
||||
if salt.utils.is_proxy():
|
||||
gfn = os.path.join(
|
||||
__opts__['conf_file'],
|
||||
'proxy.d',
|
||||
__opts__['id'],
|
||||
'grains'
|
||||
)
|
||||
else:
|
||||
gfn = os.path.join(
|
||||
__opts__['conf_file'],
|
||||
'grains'
|
||||
)
|
||||
else:
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'grains'
|
||||
)
|
||||
if salt.utils.is_proxy():
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'proxy.d',
|
||||
__opts__['id'],
|
||||
'grains'
|
||||
)
|
||||
else:
|
||||
gfn = os.path.join(
|
||||
os.path.dirname(__opts__['conf_file']),
|
||||
'grains'
|
||||
)
|
||||
|
||||
if os.path.isfile(gfn):
|
||||
with salt.utils.fopen(gfn, 'rb') as fp_:
|
||||
|
Loading…
Reference in New Issue
Block a user