mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #24112 from The-Loeki/patch-1
thin_gen breaks when thinver doesn't exist
This commit is contained in:
commit
84e65dece7
1 changed files with 15 additions and 8 deletions
|
@ -86,14 +86,21 @@ def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods=''):
|
|||
with salt.utils.fopen(salt_call, 'w+') as fp_:
|
||||
fp_.write(SALTCALL)
|
||||
if os.path.isfile(thintar):
|
||||
with salt.utils.fopen(thinver) as fh_:
|
||||
if overwrite or not os.path.isfile(thinver):
|
||||
try:
|
||||
os.remove(thintar)
|
||||
except OSError:
|
||||
pass
|
||||
elif fh_.read() == salt.version.__version__:
|
||||
return thintar
|
||||
if not overwrite:
|
||||
if os.path.isfile(thinver):
|
||||
with salt.utils.fopen(thinver) as fh_:
|
||||
overwrite = fh_.read() != salt.version.__version__
|
||||
else:
|
||||
overwrite = True
|
||||
|
||||
if overwrite:
|
||||
try:
|
||||
os.remove(thintar)
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
return thintar
|
||||
|
||||
tops = [
|
||||
os.path.dirname(salt.__file__),
|
||||
os.path.dirname(jinja2.__file__),
|
||||
|
|
Loading…
Add table
Reference in a new issue