wido commented on a change in pull request #3197: Fix XenServer Security Groups
'vmops' script
URL: https://github.com/apache/cloudstack/pull/3197#discussion_r261106033
##########
File path: scripts/vm/hypervisor/xenserver/vmops
##########
@@ -1438,14 +1448,31 @@ def network_rules(session, args):
cmds = []
egressrules = 0
for line in lines:
- tokens = line.split(':')
- if len(tokens) != 5:
- continue
- token_type = tokens[0]
- protocol = tokens[1]
- start = tokens[2]
- end = tokens[3]
+ logging.debug("Processing rule [%s]." % line)
+
+ #Example of rule: [I:tcp;12;34;1.2.3.4/24,NEXT] -> tokens: ['I:tcp',
'12', '34', '1.2.3.4/24,NEXT'].
+ tokens = line.split(';')
+ logging.debug("Tokens %s." % tokens)
+
+ tokens_size = len(tokens)
+
+ expected_tokens_size = 4
+ if tokens_size != expected_tokens_size:
+ logging.warning("Network rule tokens size [%s] is different from
the expected size [%s], ignoring rule %s" % (str(tokens_size),
str(expected_tokens_size), tokens))
+ continue
+
+ #Example of rule: [I:tcp;12;34;1.2.3.4/24,NEXT]
+ #tokens[0] = I:tcp
+ # token_type: I
+ # protocol: tcp
+ token_type, protocol = tokens[0].split(':')
+ #tokens[1] = '12'
+ start = tokens[1]
+ #tokens[2] = '34'
+ end = tokens[2]
+ #cidrs = ['1.2.3.4/24', 'NEXT']
cidrs = tokens.pop().split(",")
+ #cidrs = ['1.2.3.4/24']
Review comment:
All the above rules seem debugging lines, don't they?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services