From 8667ec408e9a2f2cc3d0a1463defb2f06e3637a2 Mon Sep 17 00:00:00 2001 From: Gokul Ramanathan Date: Tue, 13 Aug 2024 11:07:54 -0700 Subject: [PATCH 1/3] Update codeartifact login error message --- .../enhancement-codeartifact-32392.json | 5 +++++ awscli/customizations/codeartifact/login.py | 11 ++++++----- .../codeartifact/test_codeartifact_login.py | 19 +++++++++++++++++++ .../codeartifact/test_adapter_login.py | 15 +++++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 .changes/next-release/enhancement-codeartifact-32392.json diff --git a/.changes/next-release/enhancement-codeartifact-32392.json b/.changes/next-release/enhancement-codeartifact-32392.json new file mode 100644 index 000000000000..0b5b30bb23db --- /dev/null +++ b/.changes/next-release/enhancement-codeartifact-32392.json @@ -0,0 +1,5 @@ +{ + "type": "enhancement", + "category": "``codeartifact``", + "description": "Update login command error message." +} diff --git a/awscli/customizations/codeartifact/login.py b/awscli/customizations/codeartifact/login.py index d030bcb32eb5..6d1353fd46f7 100644 --- a/awscli/customizations/codeartifact/login.py +++ b/awscli/customizations/codeartifact/login.py @@ -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' @@ -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( @@ -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') @@ -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 }, diff --git a/tests/functional/codeartifact/test_codeartifact_login.py b/tests/functional/codeartifact/test_codeartifact_login.py index d62a2da4e973..0715d7dab330 100644 --- a/tests/functional/codeartifact/test_codeartifact_login.py +++ b/tests/functional/codeartifact/test_codeartifact_login.py @@ -3,6 +3,7 @@ import platform import subprocess import time +import re from botocore.utils import parse_timestamp @@ -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) diff --git a/tests/unit/customizations/codeartifact/test_adapter_login.py b/tests/unit/customizations/codeartifact/test_adapter_login.py index 592a98a0d8b3..890da3935011 100644 --- a/tests/unit/customizations/codeartifact/test_adapter_login.py +++ b/tests/unit/customizations/codeartifact/test_adapter_login.py @@ -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' From 278c43c793bd32ee60af767bcdad7ffe15936d37 Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Fri, 16 Aug 2024 18:05:30 +0000 Subject: [PATCH 2/3] Update changelog based on model updates --- .changes/next-release/api-change-batch-46974.json | 5 +++++ .changes/next-release/api-change-inspector2-69268.json | 5 +++++ .changes/next-release/api-change-quicksight-95401.json | 5 +++++ .changes/next-release/api-change-sagemaker-88528.json | 5 +++++ .changes/next-release/api-change-sesv2-83568.json | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 .changes/next-release/api-change-batch-46974.json create mode 100644 .changes/next-release/api-change-inspector2-69268.json create mode 100644 .changes/next-release/api-change-quicksight-95401.json create mode 100644 .changes/next-release/api-change-sagemaker-88528.json create mode 100644 .changes/next-release/api-change-sesv2-83568.json diff --git a/.changes/next-release/api-change-batch-46974.json b/.changes/next-release/api-change-batch-46974.json new file mode 100644 index 000000000000..921c82b4d574 --- /dev/null +++ b/.changes/next-release/api-change-batch-46974.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``batch``", + "description": "Improvements of integration between AWS Batch and EC2." +} diff --git a/.changes/next-release/api-change-inspector2-69268.json b/.changes/next-release/api-change-inspector2-69268.json new file mode 100644 index 000000000000..9ccfb74d6cda --- /dev/null +++ b/.changes/next-release/api-change-inspector2-69268.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``inspector2``", + "description": "Update the correct format of key and values for resource tags" +} diff --git a/.changes/next-release/api-change-quicksight-95401.json b/.changes/next-release/api-change-quicksight-95401.json new file mode 100644 index 000000000000..30d336077137 --- /dev/null +++ b/.changes/next-release/api-change-quicksight-95401.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``quicksight``", + "description": "Amazon QuickSight launches Customer Managed Key (CMK) encryption for Data Source metadata" +} diff --git a/.changes/next-release/api-change-sagemaker-88528.json b/.changes/next-release/api-change-sagemaker-88528.json new file mode 100644 index 000000000000..c3c9599a3e6b --- /dev/null +++ b/.changes/next-release/api-change-sagemaker-88528.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``sagemaker``", + "description": "Introduce Endpoint and EndpointConfig Arns in sagemaker:ListPipelineExecutionSteps API response" +} diff --git a/.changes/next-release/api-change-sesv2-83568.json b/.changes/next-release/api-change-sesv2-83568.json new file mode 100644 index 000000000000..25ac97d5a715 --- /dev/null +++ b/.changes/next-release/api-change-sesv2-83568.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``sesv2``", + "description": "Marking use case description field of account details as deprecated." +} From fe1a740f5e92e7806e94e3bab73f99cbb8db38bc Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Fri, 16 Aug 2024 18:06:59 +0000 Subject: [PATCH 3/3] Bumping version to 1.34.0 --- .changes/1.34.0.json | 32 +++++++++++++++++++ .../next-release/api-change-batch-46974.json | 5 --- .../api-change-inspector2-69268.json | 5 --- .../api-change-quicksight-95401.json | 5 --- .../api-change-sagemaker-88528.json | 5 --- .../next-release/api-change-sesv2-83568.json | 5 --- .../enhancement-codeartifact-32392.json | 5 --- CHANGELOG.rst | 11 +++++++ awscli/__init__.py | 2 +- doc/source/conf.py | 4 +-- setup.cfg | 2 +- setup.py | 2 +- 12 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 .changes/1.34.0.json delete mode 100644 .changes/next-release/api-change-batch-46974.json delete mode 100644 .changes/next-release/api-change-inspector2-69268.json delete mode 100644 .changes/next-release/api-change-quicksight-95401.json delete mode 100644 .changes/next-release/api-change-sagemaker-88528.json delete mode 100644 .changes/next-release/api-change-sesv2-83568.json delete mode 100644 .changes/next-release/enhancement-codeartifact-32392.json diff --git a/.changes/1.34.0.json b/.changes/1.34.0.json new file mode 100644 index 000000000000..cb4a18d67474 --- /dev/null +++ b/.changes/1.34.0.json @@ -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" + } +] \ No newline at end of file diff --git a/.changes/next-release/api-change-batch-46974.json b/.changes/next-release/api-change-batch-46974.json deleted file mode 100644 index 921c82b4d574..000000000000 --- a/.changes/next-release/api-change-batch-46974.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``batch``", - "description": "Improvements of integration between AWS Batch and EC2." -} diff --git a/.changes/next-release/api-change-inspector2-69268.json b/.changes/next-release/api-change-inspector2-69268.json deleted file mode 100644 index 9ccfb74d6cda..000000000000 --- a/.changes/next-release/api-change-inspector2-69268.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``inspector2``", - "description": "Update the correct format of key and values for resource tags" -} diff --git a/.changes/next-release/api-change-quicksight-95401.json b/.changes/next-release/api-change-quicksight-95401.json deleted file mode 100644 index 30d336077137..000000000000 --- a/.changes/next-release/api-change-quicksight-95401.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``quicksight``", - "description": "Amazon QuickSight launches Customer Managed Key (CMK) encryption for Data Source metadata" -} diff --git a/.changes/next-release/api-change-sagemaker-88528.json b/.changes/next-release/api-change-sagemaker-88528.json deleted file mode 100644 index c3c9599a3e6b..000000000000 --- a/.changes/next-release/api-change-sagemaker-88528.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``sagemaker``", - "description": "Introduce Endpoint and EndpointConfig Arns in sagemaker:ListPipelineExecutionSteps API response" -} diff --git a/.changes/next-release/api-change-sesv2-83568.json b/.changes/next-release/api-change-sesv2-83568.json deleted file mode 100644 index 25ac97d5a715..000000000000 --- a/.changes/next-release/api-change-sesv2-83568.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``sesv2``", - "description": "Marking use case description field of account details as deprecated." -} diff --git a/.changes/next-release/enhancement-codeartifact-32392.json b/.changes/next-release/enhancement-codeartifact-32392.json deleted file mode 100644 index 0b5b30bb23db..000000000000 --- a/.changes/next-release/enhancement-codeartifact-32392.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "enhancement", - "category": "``codeartifact``", - "description": "Update login command error message." -} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 476e65e64797..6c3ecf7e8e5f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ======= diff --git a/awscli/__init__.py b/awscli/__init__.py index 84217b1a60fa..d1ad507363d4 100644 --- a/awscli/__init__.py +++ b/awscli/__init__.py @@ -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 diff --git a/doc/source/conf.py b/doc/source/conf.py index b28c3200fc83..71ce2f3bcbc1 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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. diff --git a/setup.cfg b/setup.cfg index 7c98cf3fbdb6..d62195ceee3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py index a4d88fe932e9..2d3ee34077eb 100644 --- a/setup.py +++ b/setup.py @@ -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',