mirror of
https://github.com/ansible/awx.git
synced 2026-07-29 17:09:55 -02:30
A couple of bug fixes
This commit is contained in:
@@ -87,24 +87,24 @@ def package(target, data, timestamp):
|
||||
for name, (item, version) in data.items():
|
||||
try:
|
||||
if isinstance(item, str):
|
||||
info = f.gettarinfo(item, arcname=f'./{name}')
|
||||
f.addfile(info)
|
||||
f.add(item, arcname=f'./{name}')
|
||||
else:
|
||||
fileobj = io.BytesIO(json.dumps(item).encode('utf-8'))
|
||||
buf = json.dumps(item).encode('utf-8')
|
||||
info = tarfile.TarInfo(f'./{name}')
|
||||
info.size = len(fileobj.getvalue())
|
||||
info.size = len(buf)
|
||||
info.mtime = timestamp.timestamp()
|
||||
f.addfile(info, fileobj=fileobj)
|
||||
f.addfile(info, fileobj=io.BytesIO(buf))
|
||||
manifest[name] = version
|
||||
except Exception:
|
||||
logger.exception(f"Could not generate metric {name}")
|
||||
return None
|
||||
|
||||
try:
|
||||
fileobj = io.BytesIO(json.dumps(manifest).encode('utf-8'))
|
||||
buf = json.dumps(manifest).encode('utf-8')
|
||||
info = tarfile.TarInfo('./manifest.json')
|
||||
info.size = len(fileobj.getvalue())
|
||||
info.size = len(buf)
|
||||
info.mtime = timestamp.timestamp()
|
||||
f.addfile(info, fileobj=fileobj)
|
||||
f.addfile(info, fileobj=io.BytesIO(buf))
|
||||
except Exception:
|
||||
logger.exception("Could not generate manifest.json")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user