source/skopeo: use subprocess.check_output
Use `subprocess.check_output` instead of `run(..., capture_output=True)` since the latter only got added in Python 3.7 and our codebase needs to be compatible with 3.6 due to RHEL 8.x.
This commit is contained in:
parent
3fd864e5a9
commit
4647140808
1 changed files with 2 additions and 4 deletions
|
|
@ -102,10 +102,8 @@ class SkopeoSource(sources.SourceService):
|
|||
# Verify that the digest supplied downloaded the correct container image id.
|
||||
# The image id is the digest of the config, but skopeo can' currently
|
||||
# get the config id, only the full config, so we checksum it ourselves.
|
||||
res = subprocess.run(["skopeo", "inspect", "--raw", "--config", destination],
|
||||
capture_output=True,
|
||||
check=True)
|
||||
downloaded_id = "sha256:" + hashlib.sha256(res.stdout).hexdigest()
|
||||
res = subprocess.check_output(["skopeo", "inspect", "--raw", "--config", destination])
|
||||
downloaded_id = "sha256:" + hashlib.sha256(res).hexdigest()
|
||||
if downloaded_id != image_id:
|
||||
raise RuntimeError(
|
||||
f"Downloaded image {imagename}@{digest} has a id of {downloaded_id}, but expected {image_id}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue