From 4ec4a8379f2847b2c39647d035ee601cec67e46d Mon Sep 17 00:00:00 2001 From: Jerry Sun Date: Thu, 30 Jun 2022 12:33:09 -0400 Subject: [PATCH] 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 --- .../roles/common/push-docker-images/files/get_registry_auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/playbookconfig/src/playbooks/roles/common/push-docker-images/files/get_registry_auth.py b/playbookconfig/src/playbooks/roles/common/push-docker-images/files/get_registry_auth.py index b76dcbb52..9da0a955f 100644 --- a/playbookconfig/src/playbooks/roles/common/push-docker-images/files/get_registry_auth.py +++ b/playbookconfig/src/playbooks/roles/common/push-docker-images/files/get_registry_auth.py @@ -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)