Github user duncangrant commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/319#discussion_r77517736
  
    --- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/NetworkingEffectors.java
 ---
    @@ -65,38 +64,28 @@
         @SuppressWarnings("rawtypes")
         private static class OpenPortsInSecurityGroupBody extends 
EffectorBody<Iterable> {
             @Override
    -        public Iterable<IpPermission> call(ConfigBag parameters) {
    +        public Collection<SecurityGroup> call(ConfigBag parameters) {
                 List<String> rawPortRules = parameters.get(INBOUND_PORTS_LIST);
                 IpProtocol ipProtocol = 
parameters.get(INBOUND_PORTS_LIST_PROTOCOL);
    -            JcloudsMachineLocation jcloudsMachineLocation = 
parameters.get(JCLOUDS_MACHINE_LOCATIN);
                 Preconditions.checkNotNull(ipProtocol, 
INBOUND_PORTS_LIST_PROTOCOL.getName() + " cannot be null");
                 Preconditions.checkNotNull(rawPortRules, 
INBOUND_PORTS_LIST.getName() + " cannot be null");
    -            MutableList.Builder<IpPermission> ipPermissionsBuilder = 
MutableList.builder();
    -            for (Range<Integer> portRule : 
Networking.portRulesToRanges(rawPortRules).asRanges()) {
    -                ipPermissionsBuilder.add(
    -                        IpPermission.builder()
    -                                .ipProtocol(ipProtocol)
    -                                .fromPort(portRule.lowerEndpoint())
    -                                .toPort(portRule.upperEndpoint())
    -                                .cidrBlock(Cidr.UNIVERSAL.toString())
    -                                .build());
    -            }
    -            JcloudsLocationSecurityGroupCustomizer customizer = 
JcloudsLocationSecurityGroupCustomizer.getInstance(entity());
     
    -            if (jcloudsMachineLocation == null) {
    -                Optional<Location> jcloudsMachineLocationOptional = 
tryFind(
    -                        (Iterable<Location>) 
getLocationsCheckingAncestors(null, entity()),
    -                        instanceOf(JcloudsMachineLocation.class));
    -                if (!jcloudsMachineLocationOptional.isPresent()) {
    -                    throw new IllegalArgumentException("Tried to execute 
open ports effector on an entity with no JcloudsMachineLocation");
    -                } else {
    -                    jcloudsMachineLocation = 
(JcloudsMachineLocation)jcloudsMachineLocationOptional.get();
    -                }
    +            SharedLocationSecurityGroupCustomizer 
locationSecurityGroupCustomizer = new SharedLocationSecurityGroupCustomizer();
    +            
locationSecurityGroupCustomizer.setIpProtocol(ipProtocol.name());
    +            locationSecurityGroupCustomizer.setPortRanges(rawPortRules);
    --- End diff --
    
    I'm not sure what is going on here.  You create a 
SharedLocationSecurityGroupCustomizer, configure it, and then don't use it?  
You then create another one below here that you don't configure but you use to 
customize the location.


---
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.
---

Reply via email to