You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by geomacy <gi...@git.apache.org> on 2017/02/03 17:36:42 UTC

[GitHub] brooklyn-server pull request #549: SecurityGroupEditor- Allow for different ...

GitHub user geomacy opened a pull request:

    https://github.com/apache/brooklyn-server/pull/549

    SecurityGroupEditor- Allow for different jclouds prefixes on different clouds

    jclouds on AWS uses 'jclouds#' while on Openstack it is 'jclouds-'.
    Also fix some incorrect log messages and add a bit of detail to them.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/geomacy/brooklyn-server jclouds-prefix-fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/549.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #549
    
----
commit 7f896063a55eacee2025e8d62fc6b1eec0cf4b4e
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Date:   2017-02-03T16:11:24Z

    Allow for different jclouds prefixes on different clouds.
    
    jclouds on AWS uses 'jclouds#' while on Openstack it is 'jclouds-'.
    Also fix some incorrect log messages and add a bit of detail to them.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #549: SecurityGroupEditor- Allow for different jclouds...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/549
  
    changes made as suggested thanks @neykov, and squashed 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #549: SecurityGroupEditor- Allow for different ...

Posted by neykov <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #549: SecurityGroupEditor- Allow for different ...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/549#discussion_r99397420
  
    --- 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;
    --- End diff --
    
    Now that you are using a regex could simplify to name.replaceAll("^jclouds[#-]", "")


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #549: SecurityGroupEditor- Allow for different ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/brooklyn-server/pull/549


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---