Skip to content
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

[Image Copy] Fix snapshot create issue #1172

Merged
merged 6 commits into from
Jan 9, 2020
Merged

[Image Copy] Fix snapshot create issue #1172

merged 6 commits into from
Jan 9, 2020

Conversation

qwordy
Copy link
Member

@qwordy qwordy commented Jan 3, 2020

This issue is due to a breaking change of snapshot service. The service changed a parameter (source storage account ID) from optional to mandatory recently. This PR infers source storage account ID automatically to fix this issue. Breaking change is catastrophic.

Fix issue Azure/azure-cli#11625


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

@azuresdkci
Copy link

If this PR is for a new extension or change to an existing extension, use the following to try out the changes in this PR:

docker run -it microsoft/azure-cli:latest
export EXT=<NAME>
pip install --upgrade --target ~/.azure/cliextensions/$EXT "git+https://github.com/qwordy/azure-cli-extensions.git@11625#subdirectory=src/$EXT&egg=$EXT"

if target_subscription:
subscription_id = target_subscription
else:
subscription_id = get_subscription_id(cmd.cli_ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this original service behavior? otherwise, pls help to document the behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this PR is to infer storage account ID. If target_subscription is None, use the default subscription.
Code that creates storage account.

cli_cmd = prepare_cli_command(['storage', 'account', 'create',
                                   '--name', target_storage_account_name,
                                   '--resource-group', transient_resource_group_name,
                                   '--location', location,
                                   '--sku', 'Standard_LRS'],
                                  subscription=target_subscription)

@yungezz
Copy link
Member

yungezz commented Jan 5, 2020

the scenario: no specifying target_subscription is covered by test, right? and it doesn't fail because run only in recorded way, but not live run, right?

@qwordy
Copy link
Member Author

qwordy commented Jan 6, 2020

the scenario: no specifying target_subscription is covered by test, right? and it doesn't fail because run only in recorded way, but not live run, right?

This issue is caused by a breaking change in service. There is no automatic testing in this module. I test manually. I made the minimal change to fix issue 11625. "target_subscription" is not the focus of this issue and PR.

@yungezz
Copy link
Member

yungezz commented Jan 6, 2020

the scenario: no specifying target_subscription is covered by test, right? and it doesn't fail because run only in recorded way, but not live run, right?

This issue is caused by a breaking change in service. There is no automatic testing in this module. I test manually. I made the minimal change to fix issue 11625. "target_subscription" is not the focus of this issue and PR.

fix typo. source-storage-account-id :) . there's test to cover source-storage-account-id none?

@qwordy
Copy link
Member Author

qwordy commented Jan 6, 2020

OK. I can add a test case for this PR although there is no testing in this module now.

@qwordy qwordy changed the title [Image Copy]Fix issue 11625 [Image Copy] Fix snapshot create issue Jan 7, 2020
@qwordy qwordy requested a review from mmyyrroonn January 8, 2020 03:13
Copy link
Contributor

@tamirkamara tamirkamara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@qwordy qwordy merged commit 9f07cf5 into Azure:master Jan 9, 2020
ManuInNZ pushed a commit to ManuInNZ/azure-cli-extensions that referenced this pull request Apr 11, 2020
* [Image Copy]Fix issue 11625

* Add test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants