Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion awscli/argprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TooComplexError(Exception):


def unpack_argument(
session, service_name, operation_name, cli_argument, value
session, service_name, operation_name, cli_argument, value, parsed_globals
):
"""
Unpack an argument's value from the commandline. This is part one of a two
Expand All @@ -83,6 +83,7 @@ def unpack_argument(
value=value,
service_name=service_name,
operation_name=operation_name,
parsed_globals=parsed_globals,
)

if value_override is not None:
Expand Down
24 changes: 13 additions & 11 deletions awscli/clidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def __call__(self, args, parsed_globals):
event, parsed_args=parsed_args, parsed_globals=parsed_globals
)
call_parameters = self._build_call_parameters(
parsed_args, self.arg_table
parsed_args, self.arg_table, parsed_globals
)

self._detect_binary_file_migration_change(
Expand Down Expand Up @@ -596,7 +596,7 @@ def _add_help(self, parser):
# CLIArguments for values.
parser.add_argument('help', nargs='?')

def _build_call_parameters(self, args, arg_table):
def _build_call_parameters(self, args, arg_table, parsed_globals):
# We need to convert the args specified on the command
# line as valid **kwargs we can hand to botocore.
service_params = {}
Expand All @@ -607,19 +607,19 @@ def _build_call_parameters(self, args, arg_table):
py_name = arg_object.py_name
if py_name in parsed_args:
value = parsed_args[py_name]
value = self._unpack_arg(arg_object, value)
value = self._unpack_arg(arg_object, value, parsed_globals)
arg_object.add_to_params(service_params, value)
return service_params

def _unpack_arg(self, cli_argument, value):
def _unpack_arg(self, cli_argument, value, parsed_globals):
# Unpacks a commandline argument into a Python value by firing the
# load-cli-arg.service-name.operation-name event.
session = self._session
service_name = self._operation_model.service_model.endpoint_prefix
operation_name = xform_name(self._name, '-')

return unpack_argument(
session, service_name, operation_name, cli_argument, value
session, service_name, operation_name, cli_argument, value, parsed_globals
)

def _create_argument_table(self):
Expand Down Expand Up @@ -694,13 +694,15 @@ def _detect_binary_file_migration_change(
]
if arg_values_to_check:
print(
'AWS CLI v2 UPGRADE WARNING: When specifying a blob-type '
'parameter, AWS CLI v2 will assume the parameter value is '
'base64-encoded. To maintain v1 behavior after upgrading '
'to v2, set the `cli_binary_format` configuration '
'\nAWS CLI v2 UPGRADE WARNING: When specifying a '
'blob-type parameter, AWS CLI v2 will assume the '
'parameter value is base64-encoded. This is different '
'from v1 behavior, where the AWS CLI will automatically '
'encode the value to base64. To retain v1 behavior in '
'AWS CLI v2, set the `cli_binary_format` configuration '
'variable to `raw-in-base64-out`. See '
'https://docs.aws.amazon.com/cli/latest/userguide'
'/cliv2-migration-changes.html'
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
'#cliv2-migration-binaryparam.\n',
file=sys.stderr
)
Expand Down
17 changes: 9 additions & 8 deletions awscli/customizations/cloudformation/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,15 @@ def deploy(self, deployer, stack_name, template_str,
try:
if v2_debug and fail_on_empty_changeset:
uni_print(
'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, '
'deploying an AWS CloudFormation Template that '
'results in an empty changeset will NOT result in an '
'error. You can add the -–no-fail-on-empty-changeset '
'flag to migrate to v2 behavior and resolve this '
'warning. See https://docs.aws.amazon.com/cli/latest/'
'userguide/cliv2-migration-changes.html'
'#cliv2-migration-cfn.\n',
'\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, deploying '
'an AWS CloudFormation Template that results in an empty '
'changeset will NOT result in an error by default. This '
'is different from v1 behavior, where empty changesets '
'result in an error by default. To migrate to v2 behavior '
'and resolve this warning, you can add the '
'`--no-fail-on-empty-changeset` flag to the command. '
'See https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-cfn.\n',
out_file=sys.stderr
)
result = deployer.create_and_wait_for_changeset(
Expand Down
3 changes: 2 additions & 1 deletion awscli/customizations/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def __call__(self, args, parsed_globals):
'custom',
self.name,
cli_argument,
value
value,
parsed_globals
)

# If this parameter has a schema defined, then allow plugins
Expand Down
109 changes: 53 additions & 56 deletions awscli/customizations/globalargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,33 @@ def resolve_cli_connect_timeout(parsed_args, session, **kwargs):
def detect_migration_breakage(parsed_args, remaining_args, session, **kwargs):
if not resolve_v2_debug_mode(parsed_args):
return
url_params = [
param for param in remaining_args
if param.startswith('http://') or param.startswith('https://')
]
region = parsed_args.region or session.get_config_variable('region')
s3_config = session.get_config_variable('s3')
if (
not session.get_scoped_config().get('cli_pager', None)
== '' and 'AWS_PAGER' not in os.environ
):
uni_print(
'AWS CLI v2 UPGRADE WARNING: By default, the AWS CLI version 2 '
'returns all output through your operating system’s default pager '
'program. To retain AWS CLI v1 behavior after upgrading to AWS '
'CLI v2, set the `cli_pager` configuration setting, or the '
'\nAWS CLI v2 UPGRADE WARNING: By default, the AWS CLI v2 returns '
'all output through your operating system’s default pager '
'program. This is different from v1 behavior, where the system '
'pager is not used by default. To retain AWS CLI v1 behavior in '
'AWS CLI v2, set the `cli_pager` configuration setting, or the '
'`AWS_PAGER` environment variable, to the empty string. See '
'https://docs.aws.amazon.com/cli/latest/userguide'
'/cliv2-migration-changes.html#cliv2-migration-output-pager.\n',
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-output-pager.\n',
out_file=sys.stderr
)
if 'PYTHONUTF8' in os.environ or 'PYTHONIOENCODING' in os.environ:
if 'AWS_CLI_FILE_ENCODING' not in os.environ:
uni_print(
'AWS CLI v2 UPGRADE WARNING: The PYTHONUTF8 and '
'PYTHONIOENCODING environment variables are unsupported '
'in AWS CLI v2. AWS CLI v2 uses the `AWS_CLI_FILE_ENCODING` '
'variable instead; set this environment variable to retain '
'AWS CLI v1 behavior after upgrading to AWS CLI v2. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'\nThe AWS CLI v2 does not support The `PYTHONUTF8` and '
'`PYTHONIOENCODING` environment variables, and instead uses '
'the `AWS_CLI_FILE_ENCODING` variable. This is different from '
'v1 behavior, where the former two variables are used '
'instead. To retain AWS CLI v1 behavior in AWS CLI v2, set '
'the `AWS_CLI_FILE_ENCODING` environment variable instead. '
'See https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
'#cliv2-migration-encodingenvvar.\n',
out_file=sys.stderr
Expand All @@ -152,45 +150,38 @@ def detect_migration_breakage(parsed_args, remaining_args, session, **kwargs):
)
if session.get_config_variable('api_versions'):
uni_print(
'AWS CLI v2 UPGRADE WARNING: The AWS CLI v2 does not support '
'calling earlier versions of AWS service APIs via the '
'`api_versions` configuration file setting. To migrate to v2 '
'\nAWS CLI v2 UPGRADE WARNING: AWS CLI v2 UPGRADE WARNING: '
'The AWS CLI v2 does not support calling older versions of AWS '
'service APIs via the `api_versions` configuration file setting. This '
'is different from v1 behavior, where this configuration setting '
'can be used to pin older API versions. To migrate to v2 '
'behavior, remove the `api_versions` configuration setting, and '
'test against the latest API versions. See '
'test against the latest service API versions. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-api-versions.\n',
out_file = sys.stderr
)
if session.full_config.get('plugins', {}):
uni_print(
'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, plugin support '
'is provisional. If you rely on plugins, be sure to lock into '
'a particular version of the AWS CLI and test the '
'functionality of your plugins for each upgrade. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#'
'cliv2-migration-profile-plugins\n',
'\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, plugins are '
'disabled by default, and support for plugins is provisional. '
'This is different from v1 behavior, where plugin support is URL '
'below to update your configuration to enable plugins in AWS CLI '
'v2. Also, be sure to lock into a particular version of the AWS '
'CLI and test the functionality of your plugins every time AWS '
'CLI v2 is upgraded. See https://docs.aws.amazon.com/cli/latest/'
'userguide/cliv2-migration-changes.html'
'#cliv2-migration-profile-plugins.\n',
out_file=sys.stderr
)
if parsed_args.command == 'ecr' and remaining_args[0] == 'get-login':
uni_print(
'AWS CLI v2 UPGRADE WARNING: The `ecr get-login` command has '
'\nAWS CLI v2 UPGRADE WARNING: The `ecr get-login` command has '
'been removed in AWS CLI v2. You must use `ecr get-login-password` '
'instead. See https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-ecr-get-login.\n',
out_file=sys.stderr
)
if url_params and session.get_scoped_config().get('cli_follow_urlparam', True):
uni_print(
'AWS CLI v2 UPGRADE WARNING: For input parameters that have '
'a prefix of http:// or https://, AWS CLI v2 will no longer '
'automatically request the content of the URL for the '
'parameter, and the `cli_follow_urlparam` option has been '
'removed. See https://docs.aws.amazon.com/cli/latest/'
'userguide/cliv2-migration-changes.html'
'#cliv2-migration-paramfile.\n',
out_file=sys.stderr
)
for working, obsolete in HIDDEN_ALIASES.items():
working_split = working.split('.')
working_service = working_split[0]
Expand All @@ -202,12 +193,13 @@ def detect_migration_breakage(parsed_args, remaining_args, session, **kwargs):
and f"--{working_param}" in remaining_args
):
uni_print(
'AWS CLI v2 UPGRADE WARNING: You have entered command '
'arguments that uses at least 1 of 21 hidden aliases that '
'were removed in AWS CLI v2. You must replace usage of the '
'obsolete alias with the corresponding working parameter. See '
'https://docs.aws.amazon.com/cli/latest/userguide'
'/cliv2-migration-changes.html#cliv2-migration-aliases.\n',
'\nAWS CLI v2 UPGRADE WARNING: You have entered command '
'arguments that use at least 1 of 21 built-in ("hidden") '
'aliases that were removed in AWS CLI v2. For this command '
'to work in AWS CLI v2, you must replace usage of the alias '
'with the corresponding parameter in AWS CLI v2. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-aliases.\n',
out_file=sys.stderr
)
# Register against the provide-client-params event to ensure that the
Expand All @@ -230,12 +222,14 @@ def warn_if_east_configured_global_endpoint(request, operation_name, **kwargs):
# from botocore, we check the endpoint URL directly.
if 's3.amazonaws.com' in request.url:
uni_print(
'AWS CLI v2 UPGRADE WARNING: When you configure AWS CLI v2 '
'to use the `us-east-1` region, it uses the true regional '
'endpoint rather than the global endpoint. To retain AWS CLI v1 '
'behavior after upgrading to AWS CLI v2, configure the `region` '
'setting to `aws-global`. See https://docs.aws.amazon.com/cli'
'/latest/userguide/cliv2-migration-changes.html'
'\nAWS CLI v2 UPGRADE WARNING: When you configure AWS CLI v2 to '
'use the `us-east-1` region, it uses the true regional endpoint '
'rather than the global endpoint. This is different from v1 '
'behavior, where the global endpoint would be used when the '
'region is `us-east-1`. To retain AWS CLI v1 behavior in AWS '
'CLI v2, configure the region setting to `aws-global`. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
'#cliv2-migration-s3-regional-endpoint.\n',
out_file=sys.stderr
)
Expand All @@ -249,11 +243,14 @@ def warn_if_sigv2(
):
if context.get('auth_type', None) == 'v2':
uni_print(
'AWS CLI v2 UPGRADE WARNING: The AWS CLI v2 only uses Signature '
'v4 to authenticate Amazon S3 requests. To migrate to AWS CLI '
'v2 behavior, configure the Signature Version S3 setting to '
'version 4. See https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-sigv4\n',
'\nAWS CLI v2 UPGRADE WARNING: The AWS CLI v2 only uses Signature '
'v4 to authenticate Amazon S3 requests. This is different from '
'v1 behavior, where the signature used for Amazon S3 requests may '
'vary depending on configuration settings, region, and the '
'bucket being used. To migrate to AWS CLI v2 behavior, configure '
'the Signature Version S3 setting to version 4. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html#cliv2-migration-sigv4.\n',
out_file=sys.stderr
)

Expand Down
6 changes: 4 additions & 2 deletions awscli/customizations/paginate.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,12 @@ def check_should_enable_pagination_call_parameters(
]
if pagination_params_in_input_tokens:
uni_print(
'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, if you specify '
'\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, if you specify '
'pagination parameters by using a file with the '
'`--cli-input-json` parameter, automatic pagination will be '
'turned off. To retain AWS CLI v1 behavior after upgrading to '
'turned off. This is different from v1 behavior, where '
'pagination parameters specified via the `--cli-input-json` '
'parameter are ignored. To retain AWS CLI v1 behavior in '
'AWS CLI v2, remove all pagination parameters from the input '
'JSON. See https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
Expand Down
15 changes: 9 additions & 6 deletions awscli/customizations/s3/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,15 +1060,18 @@ def run(self):
if self.parameters['v2_debug']:
if operation_name == 'copy':
uni_print(
'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, object '
'\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, object '
'properties will be copied from the source in multipart '
'copies between S3 buckets. This may result in extra S3 '
'API calls being made. Breakage may occur if the principal '
'does not have permission to call these extra APIs. This '
'warning cannot be resolved. See '
'copies between S3 buckets initiated via `aws s3` '
'commands, resulting in additional S3 API calls to '
'transfer the metadata. Note that the principal must '
'have permission to call these APIs, or the command may '
'fail. This is different from v1 behavior, where metadata '
'is not copied. For guidance on retaining v1 behavior in '
'AWS CLI v2, or for more details, see '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
'#cliv2-migration-s3-copy-metadata\n\n',
'#cliv2-migration-s3-copy-metadata.\n\n',
out_file=sys.stderr
)

Expand Down
13 changes: 8 additions & 5 deletions awscli/customizations/scalarparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ def identity_with_warning(x):
if not encountered_timestamp:
encountered_timestamp = True
uni_print(
'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, all timestamp '
'response values are returned in the ISO 8601 format. To '
'migrate to v2 behavior, set the configuration variable '
'`cli_timestamp_format` to `iso8601`. See https://'
'docs.aws.amazon.com/cli/latest/userguide/'
'\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, all '
'timestamp response values are returned in the ISO 8601 '
'format. This is different from v1 behavior, where the '
'timestamps are returned as they appear in the service '
'API response. To retain AWS CLI v1 behavior in AWS CLI '
'v2, set the configuration variable '
'`cli_timestamp_format` to `wire`. See '
'https://docs.aws.amazon.com/cli/latest/userguide/'
'cliv2-migration-changes.html'
'#cliv2-migration-timestamp.\n',
out_file=sys.stderr
Expand Down
Loading