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

[ACR] Prefix storage account name with registry name #1417

Merged
merged 1 commit into from
Nov 29, 2016

Conversation

djyou
Copy link
Member

@djyou djyou commented Nov 22, 2016

  1. Prefix storage account name with registry name.
  2. Add tags to storage account.
  3. Add registry name validation to avoid creating storage account when registry name is not available.

@mention-bot
Copy link

@djyou, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DavidObando, @skkestrel and @troydai to be potential reviewers.

@@ -3,6 +3,9 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from random import choice
from string import digits
Copy link
Contributor

Choose a reason for hiding this comment

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

if these two references are used in random_storage_account_name only, please move them into the method.

if storage_client.check_name_availability(storage_account_name).name_available: #pylint: disable=no-member
return storage_account_name[:24]
else:
return random_storage_account_name(registry_name, storage_client)
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer loop instead of recursive.

if storage_client is None:
storage_client = get_storage_service_client().storage_accounts

random_suffix = ''.join(choice(digits) for i in range(3))
Copy link
Contributor

Choose a reason for hiding this comment

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

the randomness here doesn't seem to be sufficient to me. chance of conflict is fairly high comparing to the original uuid approach. if the what actually needed is 'uniqueness' rather than 'randomness' what about using a simple timestamp here?

datetime.utcnow().strftime('%Y%m%d%H%M%S')

@djyou
Copy link
Member Author

djyou commented Nov 22, 2016

/cc @sajayantony

@sajayantony
Copy link
Contributor

/cc @SteveLas
:shipit:

@djyou djyou changed the title Prefix storage account name with registry name [ACR] Prefix storage account name with registry name Nov 23, 2016
1. Use time stamp as storage account name suffix
2. Add registry name validation to avoid creating dependency resource
3. Move default storage account type to template
@djyou djyou force-pushed the doyou/storagename branch from 4228e1f to 9192284 Compare November 28, 2016 17:08
@djyou
Copy link
Member Author

djyou commented Nov 29, 2016

@tjprescott @derekbekoe Can we have this merged if there is no more comment? Thanks.

Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

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

LGTM.

@tjprescott tjprescott merged commit 01a077a into Azure:master Nov 29, 2016
@djyou djyou deleted the doyou/storagename branch November 29, 2016 23:45
xscript pushed a commit to xscript/azure-cli that referenced this pull request Nov 30, 2016
1. Use time stamp as storage account name suffix
2. Add registry name validation to avoid creating dependency resource
3. Move default storage account type to template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants