-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Storage] az storage copy: Add positional argument extra_options to pass through options to azcopy
#20702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Unfortunately, there is no easy solution for argument pass-though. Apparently, you are choosing the 1st workaround from #18869. This makes passing quotes --extra-options "--some-other-parameter \"value with space\""or even worse with single quotes both inside and outside --extra-options '--some-other-parameter '"'"'value with space'"'"' something_else'
^^^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^ # string content
$ echo '--some-other-parameter '"'"'value with space'"'"' something_else'
--some-other-parameter 'value with space' something_else
$ echo '--some-other-parameter "value with \"quote\""'
--some-other-parameter "value with \"quote\""
$ echo "--some-other-parameter \"value with \\\"quote\\\"\""
--some-other-parameter "value with \"quote\"" |
|
Things in PowerShell get worse as now you need to consider escaping 3 times from
This becomes unmanageably complicated: I don't want to explain how this works. 😣 See https://github.com/Azure/azure-cli/blob/dev/doc/quoting-issues-with-powershell.md |
|
Here is the script I use to debug argument passing in shells: # echo_args.py
import sys
def echo(args):
print('[str]')
for i, arg in enumerate(args):
print(f"{i}: {arg!s}")
print()
print('[repr]')
for i, arg in enumerate(args):
print(f"{i}: {arg!r}")
echo(sys.argv)You can invoke it by |
az storage copy: Add --extra-options to pass through options to azcopyaz storage copy: Add positional argument extra_options to pass through options to azcopy
|
Copying my comment from #20663 (comment) This topic was intensively discussed before in #18869. Then I would propose the This is a common convention in Linux world:
@chasewilson for awareness. If we go down this path, then other commands can do the same. |
I think this makes a lot of sense all things considered. I'm glad this is experimental as I'm hesitent to make this the standard for similar scenarios. From a command line perspective, it's less than ideal to have a "native" command like this where you have to know another command line tools (azcopy) parameters to make the most of it. Is there are reason we don't support wrapping the new flags and parameters. Please forgive me if i'm catching up and I'm not saying we shouldn't implement the current solution, I just want to understand all avenues before committing. Another question, are we relying on the native bash parsing for the Thank you! |
|
There has been and will be more and more |
… to pass through options to azcopy. similar to Azure#20702
…ns to pass through options to azcopy. similar to #20702 (#26127) Co-authored-by: Michael Whittaker <[email protected]>
…ns to pass through options to azcopy. similar to Azure#20702 (Azure#26127) Co-authored-by: Michael Whittaker <[email protected]>
Description
Feature asked by #20662 #20663 #20666
This PR:
extra_optionswithexperimentaltag for flexibilityazcopyfrom10.8.0to10.13.0previewtag foraz storage copyTesting Guide
az storage copy -s source_file -d destination_container_url -- --block-size-mb=0.25 --check-lengthHistory Notes
[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.