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

    https://github.com/apache/brooklyn-server/pull/319#discussion_r77519756
  
    --- 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 --
    
    Sorry, I didn't push latest changes.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to