Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/549#discussion_r99398125 --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/SecurityGroupEditor.java --- @@ -156,11 +162,14 @@ public AmbiguousGroupName(String s) { * @throws AmbiguousGroupName in the unexpected case that the cloud returns more than one matching group. */ public Optional<SecurityGroup> findSecurityGroupByName(final String name) { - final String query = name.startsWith(JCLOUDS_PREFIX) ? name : JCLOUDS_PREFIX + name; final Iterable<SecurityGroup> groupsMatching = findSecurityGroupsMatching(new Predicate<SecurityGroup>() { + final String rawName = name.matches(IS_JCLOUDS_PREFIXED_REGEX) + ? name.substring(JCLOUDS_PREFIX_REGEX.length()) + : name; + @Override public boolean apply(final SecurityGroup input) { - return input.getName().equals(query); + return input.getName().matches(JCLOUDS_PREFIX_REGEX + rawName); --- End diff -- Need to escape the name with "Pattern.quote(rawName)". Or better yet use the same method as above to strip the prefix and compare the non-prefixed names.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---