From 63b58355aeff40d3d9489b5319392129055746f1 Mon Sep 17 00:00:00 2001 From: Travis Tomsu Date: Thu, 13 Feb 2020 10:05:08 -0500 Subject: [PATCH] Cherry pick base64 encoding changes to 1.17 (#9) * fix(bintray): Use the right base64 encoding method (#5) * fix(bintray): Apply same b64 fix to other instances. (#6) --- dev/buildtool/gradle_support.py | 3 +-- dev/buildtool/inspection_commands.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/buildtool/gradle_support.py b/dev/buildtool/gradle_support.py index 4b35f8ac..c5f586b4 100644 --- a/dev/buildtool/gradle_support.py +++ b/dev/buildtool/gradle_support.py @@ -209,8 +209,7 @@ def __add_bintray_auth_header(self, request): """Adds bintray authentication header to the request.""" user = os.environ['BINTRAY_USER'] password = os.environ['BINTRAY_KEY'] - encoded_auth = base64.encodestring(str.encode('{user}:{password}'.format( - user=user, password=password)))[:-1] # strip eoln + encoded_auth = base64.b64encode('{user}:{password}'.format(user=user, password=password)) request.add_header('Authorization', 'Basic ' + bytes.decode(encoded_auth)) def bintray_repo_has_version(self, repo, package_name, repository, diff --git a/dev/buildtool/inspection_commands.py b/dev/buildtool/inspection_commands.py index fbb64eb9..2ead775c 100644 --- a/dev/buildtool/inspection_commands.py +++ b/dev/buildtool/inspection_commands.py @@ -471,7 +471,7 @@ def __init__(self, factory, options, **kwargs): password = os.environ.get('BINTRAY_KEY') if user and password: user_password = '{user}:{password}'.format(user=user, password=password) - encoded_auth = base64.encodestring(user_password.encode())[:-1] # no eoln + encoded_auth = base64.b64encode(user_password) self.__basic_auth = 'Basic %s' % encoded_auth.decode() else: self.__basic_auth = None @@ -1120,7 +1120,7 @@ def filter_from_candidates(newest_version, candidate_version_list): unused_list = unused_map.get('spinnaker-monitoring', []) if unused_list: name = 'spinnaker-monitoring' - + newest_version = self.most_recent_version(name, unused_list) candidates = filter_from_candidates(newest_version, unused_list)