This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.11 by this push:
new f80f00e CLOUDSTACK-10242: Properly parse incoming rules to Sec Group
(#2418)
f80f00e is described below
commit f80f00ebcb6c626a004c2b528b4026710f01e794
Author: Wido den Hollander <[email protected]>
AuthorDate: Tue Jan 23 20:21:49 2018 +0100
CLOUDSTACK-10242: Properly parse incoming rules to Sec Group (#2418)
With merge of PR #2028 the separator for lines to the Security Group
Python script changed from : to ; to support IPv6 addresses.
This broke certain situations where rules were parsed improperly. This
commit fixes the issue.
Signed-off-by: Wido den Hollander <[email protected]>
Signed-off-by: Rohit Yadav <[email protected]>
---
scripts/vm/network/security_group.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/scripts/vm/network/security_group.py
b/scripts/vm/network/security_group.py
index 9b8ac64..6a11057 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -951,16 +951,15 @@ def parse_network_rules(rules):
if rules is None or len(rules) == 0:
return ret
- lines = rules.split(';')[:-1]
+ lines = rules.split('NEXT;')[:-1]
for line in lines:
- tokens = line.split(':', 4)
- if len(tokens) != 5:
+ tokens = line.split(';', 3)
+ if len(tokens) != 4:
continue
- ruletype = tokens[0]
- protocol = tokens[1]
- start = int(tokens[2])
- end = int(tokens[3])
+ ruletype, protocol = tokens[0].split(':')
+ start = int(tokens[1])
+ end = int(tokens[2])
cidrs = tokens.pop();
ipv4 = []
--
To stop receiving notification emails like this one, please contact
[email protected].