File ac_avoid_f-strings.patch of Package azure-cli.28525
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/acs/custom.py azure-cli-2.17.1/azure/cli/command_modules/acs/custom.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/acs/custom.py 2020-12-31 09:24:48.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/acs/custom.py 2023-03-10 13:10:37.652906079 +0100
@@ -2729,8 +2729,8 @@
if addon_profile.enabled:
raise CLIError('The ingress-appgw addon is already enabled for this managed cluster.\n'
'To change ingress-appgw configuration, run '
- f'"az aks disable-addons -a ingress-appgw -n {name} -g {resource_group_name}" '
- 'before enabling it again.')
+ '"az aks disable-addons -a ingress-appgw -n {name} -g {resource_group_name}" '
+ 'before enabling it again.'.format(name=name, resource_group_name=resource_group_name))
addon_profile = ManagedClusterAddonProfile(enabled=True, config={})
if appgw_name is not None:
addon_profile.config[CONST_INGRESS_APPGW_APPLICATION_GATEWAY_NAME] = appgw_name
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/cdn/custom/custom.py azure-cli-2.17.1/azure/cli/command_modules/cdn/custom/custom.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/cdn/custom/custom.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/cdn/custom/custom.py 2023-03-09 16:11:35.638227544 +0100
@@ -80,7 +80,7 @@
# default origin group is specified as a name, format it as an ID.
if default_origin_group is not None:
if '/' not in default_origin_group:
- default_origin_group = f'{instance.id}/originGroups/{default_origin_group}'
+ default_origin_group = '{instance_id}/originGroups/{default_origin_group}'.format(instance_id=instance.id, default_origin_group=default_origin_group)
default_origin_group = ResourceReference(id=default_origin_group)
params = EndpointUpdateParameters(
@@ -637,13 +637,13 @@
def parse_range(error_range: str):
split = error_range.split('-')
if not split or len(split) > 2:
- raise CLIError(f'range "{error_range}" is invalid')
+ raise CLIError('range "{error_range}" is invalid'.format(error_range=error_range))
try:
begin = split[0]
end = split[1] if len(split) == 2 else begin
except ValueError:
- raise CLIError(f'range "{error_range}" is invalid')
+ raise CLIError('range "{error_range}" is invalid'.format(error_range=error_range))
return HttpErrorRangeParameters(being=begin, end=end)
@@ -694,9 +694,9 @@
for origin in origins.split(','):
# If the origin is not an ID, assume it's a name and format it as an ID.
if '/' not in origin:
- origin = f'/subscriptions/{client.config.subscription_id}/resourceGroups/{resource_group_name}' \
- f'/providers/Microsoft.Cdn/profiles/{profile_name}/endpoints/{endpoint_name}' \
- f'/origins/{origin}'
+ origin = '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}'.format(subscription_id=client.config.subscription_id, resource_group_name=resource_group_name) \
+ '/providers/Microsoft.Cdn/profiles/{profile_name}/endpoints/{endpoint_name}'.format(profile_name=profile_name, endpoint_name=endpoint_name) \
+ '/origins/{origin}'.format(origin=origin)
formatted_origins.append(ResourceReference(id=origin))
origin_group = OriginGroup(origins=formatted_origins,
@@ -779,9 +779,9 @@
for origin in origins.split(','):
# If the origin is not an ID, assume it's a name and format it as an ID.
if '/' not in origin:
- origin = f'/subscriptions/{client.config.subscription_id}/resourceGroups/{resource_group_name}' \
- f'/providers/Microsoft.Cdn/profiles/{profile_name}/endpoints/{endpoint_name}' \
- f'/origins/{origin}'
+ origin = '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}'.format(subscription_id=client.config.subscription_id, resource_group_name=resource_group_name) \
+ '/providers/Microsoft.Cdn/profiles/{profile_name}/endpoints/{endpoint_name}'.format(profile_name=profile_name, endpoint_name=endpoint_name) \
+ '/origins/{origin}'.format(origin=origin)
formatted_origins.append(ResourceReference(id=origin))
origin_group = OriginGroupUpdateParameters(
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/cdn/custom/custom_waf.py azure-cli-2.17.1/azure/cli/command_modules/cdn/custom/custom_waf.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/cdn/custom/custom_waf.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/cdn/custom/custom_waf.py 2023-03-09 16:54:05.473995576 +0100
@@ -26,7 +26,7 @@
link = client.get(resource_group_name, profile_name, endpoint_name).web_application_firewall_policy_link
if link is not None:
return link
- raise CLIError(f"endpoint {endpoint_name} does not have a CDN WAF policy link.", endpoint_name)
+ raise CLIError("endpoint {endpoint_name} does not have a CDN WAF policy link.".format(endpoint_name=endpoint_name), endpoint_name)
def set_endpoint_waf_policy_link(client: EndpointsOperations,
@@ -46,10 +46,10 @@
if waf_policy_subscription_id is None or waf_policy_resource_group_name is None or waf_policy_name is None:
raise CLIError('Either --waf-policy-id or all of --waf-policy-subscription-id, '
'--waf-policy-resource-group-name, and --waf-policy-name must be specified.')
- waf_policy_id = f'/subscriptions/{waf_policy_subscription_id}' \
- f'/resourceGroups/{waf_policy_resource_group_name}' \
- f'/providers/Microsoft.Cdn' \
- f'/CdnWebApplicationFirewallPolicies/{waf_policy_name}'
+ waf_policy_id = '/subscriptions/{waf_policy_subscription_id}'.format(waf_policy_subscription_id=waf_policy_subscription_id) \
+ '/resourceGroups/{waf_policy_resource_group_name}'.format(waf_policy_resource_group_name=waf_policy_resource_group_name) \
+ '/providers/Microsoft.Cdn' \
+ '/CdnWebApplicationFirewallPolicies/{waf_policy_name}'.format(waf_policy_name=waf_policy_name)
endpoint.web_application_firewall_policy_link = \
EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(id=waf_policy_id)
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_color.py azure-cli-2.17.1/azure/cli/command_modules/resource/_color.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_color.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/resource/_color.py 2023-03-10 12:10:41.343512486 +0100
@@ -40,7 +40,7 @@
return self
def append_line(self, value="", color=None):
- self.append(f"{str(value)}\n", color)
+ self.append("{value}\n".format(value=str(value)), color)
return self
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/resource/custom.py azure-cli-2.17.1/azure/cli/command_modules/resource/custom.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/resource/custom.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/resource/custom.py 2023-03-09 16:22:55.821843666 +0100
@@ -836,7 +836,7 @@
def _build_preflight_error_message(preflight_error):
- err_messages = [f'{preflight_error.code} - {preflight_error.message}']
+ err_messages = ['{code} - {message}'.format(code=preflight_error.code, message=preflight_error.message)]
for detail in preflight_error.details or []:
err_messages.append(_build_preflight_error_message(detail))
return '\n'.join(err_messages)
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_formatters.py azure-cli-2.17.1/azure/cli/command_modules/resource/_formatters.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_formatters.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/resource/_formatters.py 2023-03-10 11:48:48.228362229 +0100
@@ -129,19 +129,19 @@
def _format_change_type_count(change_type, count):
if change_type == ChangeType.create:
- return f"{count} to create"
+ return "{count} to create".format(count=count)
if change_type == ChangeType.delete:
- return f"{count} to delete"
+ return "{count} to delete".format(count=count)
if change_type == ChangeType.deploy:
- return f"{count} to deploy"
+ return "{count} to deploy".format(count=count)
if change_type == ChangeType.modify:
- return f"{count} to modify"
+ return "{count} to modify".format(count=count)
if change_type == ChangeType.ignore:
- return f"{count} to ignore"
+ return "{count} to ignore".format(count=count)
if change_type == ChangeType.no_change:
- return f"{count} no change"
+ return "{count} no change".format(count=count)
- raise ValueError(f"Invalid ChangeType: {change_type}")
+ raise ValueError("Invalid ChangeType: {change_type}".format(change_type=change_type))
def _format_resource_changes(builder, resource_changes):
@@ -152,7 +152,7 @@
resource_changes_by_scope = groupby(sorted(resource_changes, key=_get_scope_uppercase), _get_scope_uppercase)
builder.append_line()
- builder.append_line(f"The deployment will update the following {'scope:' if num_scopes == 1 else 'scopes'}")
+ builder.append_line("The deployment will update the following {scope}".format(scope='scope:' if num_scopes == 1 else 'scopes'))
for _, resource_changes_in_scope in resource_changes_by_scope:
resource_changes_in_scope_list = list(resource_changes_in_scope)
@@ -161,7 +161,7 @@
def _format_resource_changes_in_scope(builder, scope, resource_changes_in_scope):
- builder.append_line().append_line(f"Scope: {scope}")
+ builder.append_line().append_line("Scope: {scope}".format(scope=scope))
sorted_resource_changes = sorted(
resource_changes_in_scope,
@@ -257,7 +257,7 @@
_format_property_change_path(builder, property_change, "children", max_path_length, indent_level)
_format_property_array_change(builder, children, indent_level + 1)
else:
- raise ValueError(f"Unknown property change type: {property_change_type}.")
+ raise ValueError("Unknown property change type: {property_change_type}.".format(property_change_type=property_change_type))
def _format_property_change_path(builder, property_change, value_name, max_path_length, indent_level):
@@ -410,7 +410,7 @@
elif _is_non_empty_object(value):
_format_non_empty_object(builder, value, path, max_path_length, indent_level)
else:
- raise ValueError(f"Invalid JSON value: {value}")
+ raise ValueError("Invalid JSON value: {value}".format(value=value))
def _format_leaf(builder, value):
@@ -454,7 +454,7 @@
indent_level += 1
for child_path, child_value in value.items():
- child_path = child_path if is_root else f"{path}{Symbol.DOT}{child_path}"
+ child_path = child_path if is_root else "{path}{DOT}{child_path}".format(path=path,DOT=Symbol.DOT,child_path=child_path)
_format_json(builder, child_value, child_path, max_path_length, indent_level)
# if _is_non_empty_array(child_value) or _is_leaf(child_value):
diff -Nru azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_utils.py azure-cli-2.17.1/azure/cli/command_modules/resource/_utils.py
--- azure-cli-2.17.1.orig/azure/cli/command_modules/resource/_utils.py 2020-12-31 09:24:49.000000000 +0100
+++ azure-cli-2.17.1/azure/cli/command_modules/resource/_utils.py 2023-03-09 17:50:53.132347905 +0100
@@ -54,22 +54,22 @@
)
if management_group_match:
- management_group_relative_id = f"Microsoft.Management/ManagementGroups/{management_group_id}"
+ management_group_relative_id = "Microsoft.Management/ManagementGroups/{management_group_id}".format(management_group_id=management_group_id)
return (
- (f"/providers/{management_group_relative_id}", relative_resource_id)
+ ("/providers/{management_group_relative_id}".format(management_group_relative_id=management_group_relative_id), relative_resource_id)
if relative_resource_id
else ("/", management_group_relative_id)
)
if subscription_match:
- subscription_scope = f"/subscriptions/{subscription_id.lower()}"
+ subscription_scope = "/subscriptions/{lower_subscription_id}".format(lower_subscription_id=subscription_id.lower())
if resource_group_match:
- resource_group_id = f"resourceGroups/{resource_group_name}"
+ resource_group_id = "resourceGroups/{resource_group_name}".format(resource_group_name=resource_group_name)
return (
- (f"{subscription_scope}/{resource_group_id}", relative_resource_id)
+ ("{subscription_scope}/{resource_group_id}".format(subscription_scope=subscription_scope, resource_group_id=resource_group_id), relative_resource_id)
if relative_resource_id_match
else (subscription_scope, resource_group_id)
)