mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
parent
95efdad8ba
commit
71184923ee
@ -142,11 +142,16 @@ def prep_trans_tar(opts, chunks, file_refs):
|
||||
break
|
||||
cwd = os.getcwd()
|
||||
os.chdir(gendir)
|
||||
with tarfile.open(trans_tar, 'w:gz') as tfp:
|
||||
try:
|
||||
tfp = tarfile.open(trans_tar, 'w:gz')
|
||||
for root, dirs, files in os.walk(gendir):
|
||||
for name in files:
|
||||
full = os.path.join(root, name)
|
||||
tfp.add(full[len(gendir):].lstrip(os.sep))
|
||||
except Exception, ex:
|
||||
print ex
|
||||
finally:
|
||||
tfp.close()
|
||||
os.chdir(cwd)
|
||||
shutil.rmtree(gendir)
|
||||
return trans_tar
|
||||
|
Loading…
Reference in New Issue
Block a user