1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-06 12:45:57 +01:00

Allow returning raw bytes from RegistryInspect.get_manifest

> Traceback (most recent call last):
>   File "./atomic", line 189, in <module>
>     sys.exit(_func())
>   File "/home/mitr/t/atomic/Atomic/sign.py", line 85, in sign
>     manifest_file.write(manifest)
> TypeError: argument 1 must be string or buffer, not dict

Add a return_json parameter just like util.skopeo_inspect.

Alternatively it may well make sense to inline the return_json=True
variant into .remote_id(), and have .get_manifest() always return the
raw bytes.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #930
Approved by: rhatdan
This commit is contained in:
Miloslav Trmač
2017-03-04 08:21:36 +01:00
committed by Atomic Bot
parent c399125c90
commit bb997fe019
2 changed files with 3 additions and 3 deletions

View File

@@ -37,9 +37,9 @@ class RegistryInspect():
inspect_data['Name'] = self.assemble_fqdn(include_tag=False)
return inspect_data
def get_manifest(self):
def get_manifest(self, return_json=True):
assert(self.fqdn is not None)
return util.skopeo_inspect("docker://{}".format(self.fqdn), return_json=True, args=['--raw'])
return util.skopeo_inspect("docker://{}".format(self.fqdn), return_json=return_json, args=['--raw'])
@property
def remote_id(self):

View File

@@ -76,7 +76,7 @@ class Sign(Atomic):
for sign_image in images:
registry, repo, image, tag, _ = util.Decompose(sign_image).all
ri = discovery.RegistryInspect(registry, repo, image, tag, debug=self.args.debug, orig_input=sign_image)
manifest = ri.get_manifest()
manifest = ri.get_manifest(return_json=False)
try: