Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.96k forks source link

On a Mac, the `az artifact universal download` command adds files from the current directory as arguments #28969

Open DanielMrowca opened 4 months ago

DanielMrowca commented 4 months ago

Describe the bug

On a Mac, running the az artifacts download.... command in a NOT empty folder will result in an error:

ERROR: unrecognized arguments: <here_list_of_files_of_the_current_directory>

If we execute the command in an empty folder it works fine.

Related command

az artifacts universal download --organization "https://dev.azure.com/myorganization/" --feed "aray" --scope "project" --name "myname" --version * --path "." --project "myproject" --debug

Errors

Command arguments contains files 'aray_sync.ps1', 'README.md' from the executing directory:

cli.knack.cli: Command arguments: ['artifacts', 'universal', 'download', '--organization', 'https://dev.azure.com/myorganization/', '--feed', 'aray', '--scope', 'project', '--name', 'myname', '--version', 'aray_sync.ps1', 'README.md', '--path', '.', '--project', 'myproject', '--debug']
cli.azure.cli.core.azclierror: unrecognized arguments: README.md
az_command_data_logger: unrecognized arguments: README.md

Issue script & Debug output


PS /Users/danielmrowca/Documents/Repos/Forte/Aray/Test-environemnts/TEST/hub> ls
README.md   aray_sync.ps1

PS /Users/danielmrowca/Documents/Repos/Forte/Aray/Test-environemnts/TEST/hub> az artifacts universal download --organization "https://dev.azure.com/myorganization/" --feed "aray" --scope "project" --name "myname" --version * --path "." --project "myproject" --debug 
cli.knack.cli: Command arguments: ['artifacts', 'universal', 'download', '--organization', 'https://dev.azure.com/myorganization/', '--feed', 'aray', '--scope', 'project', '--name', 'myname', '--version', 'aray_sync.ps1', 'README.md', '--path', '.', '--project', 'myproject', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x1024e62a0>, <function OutputProducer.on_global_arguments at 0x1025c1580>, <function CLIQuery.on_global_arguments at 0x1025eb240>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'artifacts': ['azext_devops']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: azure-devops              0.043        60       192  /Users/danielmrowca/.azure/cliextensions/azure-devops
cli.azure.cli.core: Total (1)                 0.043        60       192  
cli.azure.cli.core: Loaded 60 groups, 192 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : artifacts universal download
cli.azure.cli.core: Command table: artifacts universal download
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x10330c7c0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/danielmrowca/.azure/commands/2024-05-15.08-51-55.artifacts_universal_download.7369.log'.
az_command_data_logger: command args: artifacts universal download --organization {} --feed {} --scope {} --name {} --version {} {} --path {} --project {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x103333240>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x103375440>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x103375580>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: [https://app.aladdin.microsoft.com:443](https://app.aladdin.microsoft.com/) "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22artifacts+universal+download%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.60.0%22%2C+%22errorType%22%3A+%22UnrecognizedArguments%22%2C+%22correlationId%22%3A+%22e0dabbfc-07c0-4a88-ba96-5903f435c4a3%22%2C+%22subscriptionId%22%3A+%2225cdd6b8-6987-4d39-95d7-a2e58b0f7c69%22%2C+%22eventId%22%3A+%223aab9bb0-8c61-4480-a45c-34eb9490f49d%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.azclierror: NoneType: None

cli.azure.cli.core.azclierror: unrecognized arguments: README.md
az_command_data_logger: unrecognized arguments: README.md

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x10330ca40>]
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 0.887 seconds (init: 0.266, invoke: 0.621)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3824 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/local/Cellar/azure-cli/2.60.0/libexec/bin/python /usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /Users/danielmrowca/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

cli.knack.cli: Command arguments should not contains files from the executing directory

Environment Summary

Device

ProductName: macOS ProductVersion: Ventura 13.6.1 BuildVersion: 22G313

Azure-Cli

core 2.60.0 telemetry 1.1.0

Extensions: azure-devops 1.0.0

Dependencies: msal 1.28.0 azure-mgmt-resource 23.1.0b2

Python location '/usr/local/Cellar/azure-cli/2.60.0/libexec/bin/python' Extensions directory '/Users/danielmrowca/.azure/cliextensions'

Python (Darwin) 3.11.9 (main, Apr 2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Additional context

No response

yonzhan commented 4 months ago

Thank you for opening this issue, we will look into it.