-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Conversation
djyou
commented
Nov 22, 2016
•
edited
Loading
edited
- Prefix storage account name with registry name.
- Add tags to storage account.
- Add registry name validation to avoid creating storage account when registry name is not available.
@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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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')
/cc @sajayantony |
/cc @SteveLas |
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
4228e1f
to
9192284
Compare
@tjprescott @derekbekoe Can we have this merged if there is no more comment? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
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