Permalink
Browse files

Upgrade: fix migration of ICMP network rules

  • Loading branch information...
1 parent b7fefa0 commit cee40b28f62f7bdd9733edc19c008ea5f318cbff Andy Grimm committed Feb 5, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 clc/modules/core/conf/upgrade/upgrade_20_30.groovy
View
18 clc/modules/core/conf/upgrade/upgrade_20_30.groovy
@@ -860,13 +860,17 @@ class upgrade_20_30 extends AbstractUpgradeScript {
peers.put(peer.network_rule_peer_network_user_query_key, peer.network_rule_peer_network_user_group);
// LOG.debug("Peer: " + networkPeer);
}
- NetworkRule networkRule = NetworkRule.create(rule.metadata_network_rule_protocol.toLowerCase(),
- [rule.metadata_network_rule_low_port, 0].max(),
- [[rule.metadata_network_rule_high_port, 65535].min(), 0].max(),
- peers as Multimap<String, String>,
- ipRanges as Collection<String>);
- initMetaClass(networkRule, networkRule.class);
- rulesGroup.getNetworkRules().add(networkRule);
+ try {
+ NetworkRule networkRule = NetworkRule.create(rule.metadata_network_rule_protocol.toLowerCase(),
+ rule.metadata_network_rule_low_port,
+ [rule.metadata_network_rule_high_port, 65535].min(),
+ peers as Multimap<String, String>,
+ ipRanges as Collection<String>);
+ initMetaClass(networkRule, networkRule.class);
+ rulesGroup.getNetworkRules().add(networkRule);
+ } catch(IllegalArgumentException e) {
+ LOG.warn("Ignored invalid network rule: protocol ${rule.metadata_network_rule_protocol}, ports ${rule.metadata_network_rule_low_port} to ${rule.metadata_network_rule_high_port}");
+ }
}
LOG.debug("adding rules group: " + rulesGroup);

0 comments on commit cee40b2

Please sign in to comment.