Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Azure/azure-cli into migrate…
Browse files Browse the repository at this point in the history
…-sig-command
  • Loading branch information
yanzhudd committed Dec 12, 2024
2 parents 92631aa + 0d770d9 commit 65a021b
Show file tree
Hide file tree
Showing 115 changed files with 234,614 additions and 141,118 deletions.
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml
- name: Codeql.Enabled
value: false
- name: ComponentDetection.ForceScan
value: eq(variables['Build.SourceBranch'], 'refs/heads/release')

parameters:
- name: architectures
Expand Down
17 changes: 0 additions & 17 deletions cgmanifest.json

This file was deleted.

4 changes: 0 additions & 4 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@ disable=
wrong-import-order,
consider-using-f-string,
unspecified-encoding,
use-maxsplit-arg,
consider-using-in,
consider-using-dict-items,
consider-using-enumerate,
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
missing-timeout,
unnecessary-dunder-call,
# These rules were added in Pylint >= 3.2
possibly-used-before-assignment,

Expand Down
2 changes: 1 addition & 1 deletion scripts/live_test/generate_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def render(data, container, container_url, testdata, USER_REPO, USER_BRANCH, COM
# elif 'sequential' in name:
# display_name = 'sequential'
try:
html = requests.get(url).content.__str__()
html = requests.get(url).text
pattern = re.compile('\\d+ tests ran in')
match = pattern.search(html)
number = match.group().split()[0]
Expand Down
6 changes: 3 additions & 3 deletions src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,10 +999,10 @@ def _generate_template_progress(self, correlation_id): # pylint: disable=no-sel

if deploy_values.get('timestamp', None) is None or \
event.event_timestamp > deploy_values.get('timestamp'):
for value in checked_values:
if deploy_values.get(checked_values[value], None) != value:
for k, v in checked_values.items():
if deploy_values.get(v, None) != k:
update = True
deploy_values[checked_values[value]] = value
deploy_values[v] = k
deploy_values['timestamp'] = event.event_timestamp

# don't want to show the timestamp
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _check_value(self, action, value):
if candidates:
# use the most likely candidate to replace the misspelled command
args_inferred = [item if item != value else candidates[0] for item in args]
command_name_inferred = ' '.join(args_inferred).split('-')[0]
command_name_inferred = ' '.join(args_inferred).split('-', maxsplit=1)[0]
else:
# `command_source` indicates command values have been parsed, value is an argument
parameter = action.option_strings[0] if action.option_strings else action.dest
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def flush():
save(get_config_dir(), _session.generate_payload())

# reset session fields, retaining correlation id and application
_session.__init__(correlation_id=_session.correlation_id, application=_session.application)
_session.__init__(correlation_id=_session.correlation_id, application=_session.application) # pylint: disable=unnecessary-dunder-call


@_user_agrees_to_telemetry
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acr/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def _token_format_group(item):
scope_map_id = _get_value(item, 'scopeMapId')
output = OrderedDict([
('NAME', _get_value(item, 'name')),
('SCOPE MAP', scope_map_id.split('/')[-1]),
('SCOPE MAP', scope_map_id.rsplit('/', maxsplit=1)[-1]),
('PASSWORD1 EXPIRY', ''),
('PASSWORD2 EXPIRY', ''),
('STATUS', _get_value(item, 'status').title()),
Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli/azure/cli/command_modules/acr/check_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,15 @@ def _check_private_endpoint(cmd, registry_name, vnet_of_private_endpoint): # py
' Please make sure you provided correct vnet')
raise CLIError(err.format(registry_name, vnet_of_private_endpoint))

for fqdn in dns_mappings:
for k, v in dns_mappings.items():
try:
result = socket.gethostbyname(fqdn)
if result != dns_mappings[fqdn]:
result = socket.gethostbyname(k)
if result != v:
err = 'DNS routing to registry "%s" through private IP is incorrect. Expect: %s, Actual: %s'
logger.warning(err, registry_name, dns_mappings[fqdn], result)
logger.warning(err, registry_name, v, result)
dns_ok = False
except Exception as e: # pylint: disable=broad-except
logger.warning('Error resolving DNS for %s. Ex: %s', fqdn, e)
logger.warning('Error resolving DNS for %s. Ex: %s', k, e)
dns_ok = False

if dns_ok:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ def test_helm_push(self, mock_requests_get, mock_get_access_credentials):

mock_get_access_credentials.return_value = 'testregistry.azurecr.io', EMPTY_GUID, 'password'

builtins_open = '__builtin__.open' if sys.version_info[0] < 3 else 'builtins.open'
builtins_open = 'builtins.open'

# Push a chart
with mock.patch(builtins_open) as mock_open:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ def ensure_container_insights_for_monitoring(
extensionSettings["dataCollectionSettings"] = dataCollectionSettings

if enable_high_log_scale_mode:
for i in range(len(cistreams)):
if cistreams[i] == "Microsoft-ContainerLogV2":
for i, v in enumerate(cistreams):
if v == "Microsoft-ContainerLogV2":
cistreams[i] = "Microsoft-ContainerLogV2-HighScale"
# create the DCR
dcr_creation_body_without_syslog = json.dumps(
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _aks_browse(
raise ResourceNotFoundError('Could not find dashboard pod: {} Command output: {}'.format(err, err.output))
if dashboard_pod:
# remove any "pods/" or "pod/" prefix from the name
dashboard_pod = str(dashboard_pod).split('/')[-1].strip()
dashboard_pod = str(dashboard_pod).rsplit('/', maxsplit=1)[-1].strip()
else:
raise ResourceNotFoundError("Couldn't find the Kubernetes dashboard pod.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------------------------

import os
import sys

from azure.cli.core.util import CLIError
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, StorageAccountPreparer
Expand Down Expand Up @@ -383,8 +382,6 @@ def test_ams_streaming_endpoint_start_async(self, storage_account_for_create):
@ResourceGroupPreparer()
@StorageAccountPreparer(parameter_name='storage_account_for_create')
def test_ams_streaming_endpoint_stop_async(self, storage_account_for_create):
if sys.version_info.major == 2: # azure-cli/issues/9386
return
amsname = self.create_random_name(prefix='ams', length=12)
streaming_endpoint_name = self.create_random_name(prefix="strep", length=12)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, src_kvs, compare_fields, preserve_labels=True, label=None, co
kv.label = label

# Returns a diff in the form {"add": List[KeyValue], "delete": List[KeyValue], "update": List[{"new": KeyValue, "old": KeyValue}]}
def compare(self, dest_kvs, strict=False):
def compare(self, dest_kvs, strict=False, ignore_matching_kvs=True):
if not strict and not self._src_kvs:
return {}

Expand All @@ -52,7 +52,7 @@ def compare(self, dest_kvs, strict=False):
kv_diff[JsonDiff.ADD].append(kv)

else:
if not self._kv_equals(kv, dest_kv_lookup[lookup_key], self._compare_fields):
if not (ignore_matching_kvs and self._kv_equals(kv, dest_kv_lookup[lookup_key], self._compare_fields)):
kv_diff[JsonDiff.UPDATE].append({"new": kv, "old": dest_kv_lookup[lookup_key]})

del dest_kv_lookup[lookup_key]
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/appconfig/keyvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def import_config(cmd,
label=label,
content_type=content_type)

kv_diff = kv_comparer.compare(dest_kvs=dest_kvs, strict=strict)
kv_diff = kv_comparer.compare(dest_kvs=dest_kvs, strict=strict, ignore_matching_kvs=import_mode == ImportMode.IGNORE_MATCH)
# Show indented key-value preview similar to kvset for appconfig source
indent = 2 if source == "appconfig" else None
need_kv_change = print_preview(kv_diff, source, yes=yes, strict=strict, title="Key Values", indent=indent)
Expand All @@ -198,7 +198,7 @@ def import_config(cmd,
compare_fields=CompareFieldsMap[source],
preserve_labels=source == "appconfig" and preserve_labels,
label=label)
ff_diff = ff_comparer.compare(dest_kvs=dest_features, strict=strict)
ff_diff = ff_comparer.compare(dest_kvs=dest_features, strict=strict, ignore_matching_kvs=import_mode == ImportMode.IGNORE_MATCH)
need_feature_change = print_preview(ff_diff, source, yes=yes, strict=strict, title="Feature Flags")

if not need_kv_change and not need_feature_change:
Expand Down
Loading

0 comments on commit 65a021b

Please sign in to comment.