-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up duplicated code in JcloudsLocationCustomizers #319
Clean up duplicated code in JcloudsLocationCustomizers #319
Conversation
} | ||
SharedLocationSecurityGroupCustomizer locationSecurityGroupCustomizer = new SharedLocationSecurityGroupCustomizer(); | ||
locationSecurityGroupCustomizer.setIpProtocol(ipProtocol.name()); | ||
locationSecurityGroupCustomizer.setPortRanges(rawPortRules); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't push latest changes.
Why are you using the SharedLocationSecurityGroupCustomizer in NetworkingEffectors? The SharedLocationSecurityGroupCustomizer is intended as a cut-down JcloudsLocationSecurityGroupCustomizer that works in yaml. As you are using java could you use JcloudsLocationSecurityGroupCustomizer and then you could avoid modifying SharedLocationSecurityGroupCustomizer? |
96b16fc
to
6a839f4
Compare
@@ -36,6 +36,7 @@ | |||
import static org.apache.brooklyn.location.jclouds.networking.NetworkingEffectors.*; | |||
|
|||
@Beta | |||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has only existed a couple of weeks? Can we just deleted it?
00fdaa2
to
4887673
Compare
@@ -74,6 +74,9 @@ | |||
|
|||
private RangeSet<Integer> tcpPortRanges; | |||
private RangeSet<Integer> udpPortRanges; | |||
private Boolean openIcmp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks useful - AWS let's you specify a protocol - does it just do "ALL"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this fails on Azure - because Azure SGs don't support ICMP - probably should add a comment documenting what will happen in this case
536d966
to
05b650e
Compare
retest this please |
@bostko Can you extend the tests in SharedLocationSecurityGroupCustomizerTest to cover the new functionality - otherwise looks good |
05b650e
to
b427cf1
Compare
@duncangrant @aledsage I added a unit test for opening ICMP. |
b427cf1
to
dcff2c3
Compare
dd48dca
to
db5b7cd
Compare
throw new IllegalArgumentException("portRule shouldn't be empty"); | ||
} | ||
if (portRule.equals("-1")) { | ||
result.add(Range.closed(Integer.parseInt("-1"), Integer.parseInt("-1"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? Strikes me as surprising and I can't see where it's required in these changes.
*/ | ||
private Boolean openIcmp; | ||
|
||
private Collection<SecurityGroup> updatedSecurityGroups; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this and getUpdatedSecurityGroups
and add a new method to the class (not sure of the best name for it, maybe simply doCustomize
?) that performs the customisation and returns the new security groups. customize(JcloudsLocation, ComputeService, JcloudsMachineLocation)
should call this new method and discard the result.
b60db38
to
5369ee0
Compare
LGTM. Will wait for Jenkins to complete before merging. |
@bostko there are four test failures:
The exception is the same in each one:
|
58584e9
to
85a4db5
Compare
which can be tested easily with unit tests.
85a4db5
to
330965f
Compare
Tests are passing now, thanks @duncangrant , @sjcorbett, @bostko. Merging. |
Unite the code from
#276
and #292
OPEN_INBOUND_PORTS_IN_SECURITY_GROUP_EFFECTOR tested after brooklyn restarts. All works fine.