-
Notifications
You must be signed in to change notification settings - Fork 271
Draft: PoC multi-arch support #626
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Swathi Gangisetty <[email protected]>
…niqueness Signed-off-by: Swathi Gangisetty <[email protected]>
Signed-off-by: Swathi Gangisetty <[email protected]>
ret = None | ||
try: | ||
proc_env = os.environ.copy() | ||
if user and pw: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this is used through the entire module which means it should be broken out into a separate function like
def set_auth_info(user=None, password=None, verify=False):
proc_env = os.environ.copy()
if user and pw:
proc_env['SKOPUSER'] = user
proc_env['SKOPPASS'] = pw
credstr = "--creds \"${SKOPUSER}\":\"${SKOPPASS}\""
else:
credstr = ""
if verify:
tlsverifystr = "--tls-verify=true"
else:
tlsverifystr = "--tls-verify=false"
return (proc_env, credstr, tlsverifystr)
This would reduce the amount of code and give us reusable functionality for future expansion.
raise err | ||
|
||
|
||
def get_image_manifest_v2(url, registry, repo, intag=None, indigest=None, user=None, pw=None, verify=True, default=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default should be set to False as it is a bool.
Signed-off-by: Swathi Gangisetty <[email protected]>
raise Exception("could not retrieve manifest") | ||
|
||
except Exception as err: | ||
raise err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have any effect and it is equal to not having it at all
s_digest = manifest_to_digest(raw_manifest) | ||
return s_manifest, s_digest | ||
except Exception as err: | ||
logger.warn("CMD failed - exception: " + str(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't add anything that the Exception wouldn't already show. Does this imply there is something beyond str(err)
that is useful to log? It seems this could do well without a try/except
block
Signed-off-by: Swathi Gangisetty [email protected]
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>)(, fixes #<issue_number, ...)
format, will close the issue when PR is merged: fixes #:Special notes: