trevorflanagan commented on this pull request.
> + String networkDomainId = server.networkInfo().networkDomainId();
+ final String internalIp =
server.networkInfo().primaryNic().privateIpv4();
+
+ // delete nat rules associated to the server, if any
+ final NetworkApi networkApi = api.getNetworkApi();
+ List<NatRule> natRulesToBeDeleted =
networkApi.listNatRules(networkDomainId).concat()
+ .filter(new Predicate<NatRule>() {
+ @Override
+ public boolean apply(NatRule natRule) {
+ return natRule.internalIp().equals(internalIp);
+ }
+ }).toList();
+
+ for (final NatRule natRule : natRulesToBeDeleted) {
+ if (natRule.state().isNormal()) {
+ networkApi.deleteNatRule(natRule.id());
Makes sense to cleanup as much as possible without failing the full operation,
I will update to have this, but I am not sure about the need for a try/catch.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/422#discussion_r154491834