mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
shippable: fix py3 issues with downloader (#46522)
This commit is contained in:
parent
4376417743
commit
25c627d256
1 changed files with 6 additions and 6 deletions
|
@ -208,7 +208,7 @@ def main():
|
|||
|
||||
if args.job_metadata:
|
||||
path = os.path.join(output_dir, '%s/job.json' % job_number)
|
||||
contents = json.dumps(j, sort_keys=True, indent=4)
|
||||
contents = json.dumps(j, sort_keys=True, indent=4).encode('utf-8')
|
||||
|
||||
if args.verbose or args.test:
|
||||
print(path)
|
||||
|
@ -219,7 +219,7 @@ def main():
|
|||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
with open(path, 'w') as metadata_fd:
|
||||
with open(path, 'wb') as metadata_fd:
|
||||
metadata_fd.write(contents)
|
||||
|
||||
if args.console_logs:
|
||||
|
@ -266,10 +266,10 @@ def extract_contents(args, path, output_dir):
|
|||
print(path)
|
||||
|
||||
if path.endswith('.json'):
|
||||
contents = json.dumps(json.loads(contents), sort_keys=True, indent=4)
|
||||
contents = json.dumps(json.loads(contents), sort_keys=True, indent=4).encode('utf-8')
|
||||
|
||||
if not os.path.exists(path):
|
||||
with open(path, 'w') as output_fd:
|
||||
with open(path, 'wb') as output_fd:
|
||||
output_fd.write(contents)
|
||||
|
||||
|
||||
|
@ -294,7 +294,7 @@ def download(args, headers, path, url, is_json=True):
|
|||
path += '.error'
|
||||
|
||||
if is_json:
|
||||
content = json.dumps(response.json(), sort_keys=True, indent=4)
|
||||
content = json.dumps(response.json(), sort_keys=True, indent=4).encode(response.encoding)
|
||||
else:
|
||||
content = response.content
|
||||
|
||||
|
@ -303,7 +303,7 @@ def download(args, headers, path, url, is_json=True):
|
|||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
with open(path, 'w') as content_fd:
|
||||
with open(path, 'wb') as content_fd:
|
||||
content_fd.write(content)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue