Fix registry credentials retrieval for Debian

Code that retrieves the registry credentials does not work properly
with Python3. This commit fixes that.

Test Plan:
  - Verify successful bootstrap for both CentOS and Debian
    using authenticated registry

Change-Id: I7a9295782a52424d3d3e386fb4ca092516e0c2b2
Closes-bug: 1980391
Signed-off-by: Jerry Sun <jerry.sun@windriver.com>
This commit is contained in:
Jerry Sun 2022-06-30 12:33:09 -04:00
parent 6d36946131
commit 4ec4a8379f

View File

@ -5,6 +5,7 @@
# SPDX-License-Identifier: Apache-2.0
#
import base64
import boto3
from botocore.config import Config
import re
@ -57,7 +58,7 @@ def get_aws_ecr_registry_credentials(registry, username, password):
response = client.get_authorization_token()
token = response['authorizationData'][0]['authorizationToken']
username, password = token.decode('base64').split(':')
username, password = base64.b64decode(token).decode('utf-8').split(':')
except Exception as e:
raise Exception(
"Failed to get AWS ECR credentials: %s" % e)