Skip to content

Commit

Permalink
Merge branch 'release-1.34.0'
Browse files Browse the repository at this point in the history
* release-1.34.0:
  Bumping version to 1.34.0
  Update changelog based on model updates
  Update codeartifact login error message
  • Loading branch information
aws-sdk-python-automation committed Aug 16, 2024
2 parents 06a4587 + fe1a740 commit 2452784
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 10 deletions.
32 changes: 32 additions & 0 deletions .changes/1.34.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"category": "``batch``",
"description": "Improvements of integration between AWS Batch and EC2.",
"type": "api-change"
},
{
"category": "``inspector2``",
"description": "Update the correct format of key and values for resource tags",
"type": "api-change"
},
{
"category": "``quicksight``",
"description": "Amazon QuickSight launches Customer Managed Key (CMK) encryption for Data Source metadata",
"type": "api-change"
},
{
"category": "``sagemaker``",
"description": "Introduce Endpoint and EndpointConfig Arns in sagemaker:ListPipelineExecutionSteps API response",
"type": "api-change"
},
{
"category": "``sesv2``",
"description": "Marking use case description field of account details as deprecated.",
"type": "api-change"
},
{
"category": "``codeartifact``",
"description": "Update login command error message.",
"type": "enhancement"
}
]
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
CHANGELOG
=========

1.34.0
======

* api-change:``batch``: Improvements of integration between AWS Batch and EC2.
* api-change:``inspector2``: Update the correct format of key and values for resource tags
* api-change:``quicksight``: Amazon QuickSight launches Customer Managed Key (CMK) encryption for Data Source metadata
* api-change:``sagemaker``: Introduce Endpoint and EndpointConfig Arns in sagemaker:ListPipelineExecutionSteps API response
* api-change:``sesv2``: Marking use case description field of account details as deprecated.
* enhancement:``codeartifact``: Update login command error message.


1.33.44
=======

Expand Down
2 changes: 1 addition & 1 deletion awscli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
import os

__version__ = '1.33.44'
__version__ = '1.34.0'

#
# Get our data path to be added to botocore's search path
Expand Down
11 changes: 6 additions & 5 deletions awscli/customizations/codeartifact/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def get_relative_expiration_time(remaining):


class CommandFailedError(Exception):
def __init__(self, called_process_error):
msg = str(called_process_error)
def __init__(self, called_process_error, auth_token):
msg = str(called_process_error).replace(auth_token, '******')
if called_process_error.stderr is not None:
msg +=(
f' Stderr from command:\n'
Expand Down Expand Up @@ -105,7 +105,7 @@ def _run_command(self, tool, command, *, ignore_errors=False):
)
except subprocess.CalledProcessError as ex:
if not ignore_errors:
raise CommandFailedError(ex)
raise CommandFailedError(ex, self.auth_token)
except OSError as ex:
if ex.errno == errno.ENOENT:
raise ValueError(
Expand Down Expand Up @@ -305,7 +305,7 @@ def login(self, dry_run=False):
)
except subprocess.CalledProcessError as e:
uni_print('Failed to update the NuGet.Config\n')
raise CommandFailedError(e)
raise CommandFailedError(e, self.auth_token)

uni_print(source_configured_message % source_name)
self._write_success_message('nuget')
Expand Down Expand Up @@ -725,7 +725,8 @@ class CodeArtifactLogin(BasicCommand):
'action': 'store_true',
'help_text': 'Only print the commands that would be executed '
'to connect your tool with your repository without '
'making any changes to your configuration',
'making any changes to your configuration. Note that '
'this prints the unredacted auth token as part of the output',
'required': False,
'default': False
},
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
# built documents.
#
# The short X.Y version.
version = '1.33.'
version = '1.34'
# The full version, including alpha/beta/rc tags.
release = '1.33.44'
release = '1.34.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 0

[metadata]
requires_dist =
botocore==1.34.162
botocore==1.35.0
docutils>=0.10,<0.17
s3transfer>=0.10.0,<0.11.0
PyYAML>=3.10,<6.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def find_version(*file_paths):


install_requires = [
'botocore==1.34.162',
'botocore==1.35.0',
'docutils>=0.10,<0.17',
's3transfer>=0.10.0,<0.11.0',
'PyYAML>=3.10,<6.1',
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/codeartifact/test_codeartifact_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import platform
import subprocess
import time
import re

from botocore.utils import parse_timestamp

Expand Down Expand Up @@ -962,6 +963,24 @@ def test_pip_login_with_namespace_dry_run(self):
'Argument --namespace is not supported for pip', result.stderr
)

def test_pip_login_command_failed_auth_token_redacted(self):
def side_effect(command, capture_output, check):
raise subprocess.CalledProcessError(
returncode=1,
cmd=command
)

self.subprocess_mock.side_effect = side_effect
cmdline = self._setup_cmd(tool='pip')
result = self.cli_runner.run(cmdline)
self.assertEqual(result.rc, 255)
self.assertIn(
"Command '['pip', 'config', 'set', 'global.index-url',"
" 'https://aws:******@domain-domain-owner.codeartifact.aws.a2z.com/pypi/repository/simple/']'"
" returned non-zero exit status 1.",
result.stderr
)

def test_twine_login_without_domain_owner(self):
cmdline = self._setup_cmd(tool='twine')
result = self.cli_runner.run(cmdline)
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/customizations/codeartifact/test_adapter_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ def test_run_commands_command_failed(self):
):
self.test_subject._run_commands('tool', ['cmd'])

def test_run_commands_command_failed_redact_auth_token(self):
error_to_be_caught = subprocess.CalledProcessError(
returncode=1,
cmd=['cmd', 'with', 'auth-token', 'present'],
output=None,
stderr=b'Command error message.'
)
self.subprocess_utils.run.side_effect = error_to_be_caught
with self.assertRaisesRegex(
CommandFailedError,
(rf"(?=.*cmd)(?=.*with)(?!.*auth-token)(?=.*present)"
rf"(?=.*Stderr from command:\nCommand error message.)")
):
self.test_subject._run_commands('tool', ['cmd'])

def test_run_commands_nonexistent_command(self):
self.subprocess_utils.run.side_effect = OSError(
errno.ENOENT, 'not found error'
Expand Down

0 comments on commit 2452784

Please sign in to comment.