Support old Barbican registry secrets
Older versions of StarlingX created Barbican registry secrets as "text/plain", that are retrieved as "string" in Python 3. This change adds support to these secrets, that may be used in upgraded systems. In non-upgraded newer systems, these secrets are created as "application/octet-stream", being retrieved as "bytes" to be decoded using UTF-8 in Python 3. Test Plan: PASS: Check that the system can retrive the registries usernames and passwords when the secrets have the content type as "text/plain". PASS: Check that the system can retrive the registries usernames and passwords when the secrets have the content type as "application/octet-stream". Closes-Bug: 2009631 Signed-off-by: Joao Victor Portal <Joao.VictorPortal@windriver.com> Change-Id: I5a71239b09ef1124449dc66f86ef790e1f23222c
This commit is contained in:
parent
587adfe010
commit
f5a8ba9f22
|
@ -3768,9 +3768,11 @@ class DockerHelper(object):
|
|||
"%s" % secret_ref))
|
||||
|
||||
try:
|
||||
if not isinstance(payload, str):
|
||||
payload = payload.decode('utf-8')
|
||||
username, password = payload.split()
|
||||
username = username.decode('utf-8').split('username:')[1]
|
||||
password = password.decode('utf-8').split('password:')[1]
|
||||
username = username.split('username:')[1]
|
||||
password = password.split('password:')[1]
|
||||
return dict(username=username, password=password)
|
||||
except Exception as e:
|
||||
LOG.error("Unable to parse the secret payload, "
|
||||
|
|
Loading…
Reference in New Issue