Skip to content

Conversation

@drigodwin
Copy link
Member

@drigodwin drigodwin commented Jan 17, 2017

Azure ARM only allows alphanumeric characters in it's naming. The default for Brooklyn is to use - characters to split up blocks of alphanumeric chars which breaks this. This adds an exception for azurecompute-arm in the same style as VM name length.

Tested with Tomcat 7 on Azure ARM, AWS and OpenStack

Copy link
Member

@neykov neykov left a comment

Choose a reason for hiding this comment

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

LGTM - some minor comments.

return null;
}

protected String generateNewIdOfLength(ConfigBag setup, int len) {
Copy link
Member

Choose a reason for hiding this comment

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

Missing @Override.

"vmNameMaxLength", "Maximum length of VM name", 60);

public static final ConfigKey<String> VM_NAME_DISALLOWED_PATTERN = ConfigKeys.newStringConfigKey(
"vmNameAllowedChars", "The character pattern to remove from a VM name", "[^a-zA-Z0-9\\-_]");
Copy link
Member

Choose a reason for hiding this comment

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

Name mismatch - VM_NAME_DISALLOWED_PATTERN, vmNameAllowedChars. Also not obvious it's a regex, figured it out after looking at the default value.

Prefer to have a white-list rather than a black list. I see that's a bit tricky to do with regexes. Could iterate through the characters of the string and match each one against the regex. wdyt?

@drigodwin
Copy link
Member Author

Addressed comments and again tested with Tomcat 7 on Azure ARM, AWS and OpenStack

@neykov
Copy link
Member

neykov commented Jan 18, 2017

Thanks @drigodwin , merging.

@asfgit asfgit merged commit 6c1de1b into apache:master Jan 18, 2017
asfgit pushed a commit that referenced this pull request Jan 18, 2017
Fix Azure ARM VM names

Azure ARM only allows alphanumeric characters in it's naming. The default for Brooklyn is to use `-` characters to split up blocks of alphanumeric chars which breaks this. This adds an exception for `azurecompute-arm` in the same style as VM name length.

Tested with Tomcat 7 on Azure ARM, AWS and OpenStack
@drigodwin drigodwin deleted the azure-naming branch January 18, 2017 12:16
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.

3 participants