File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -68,14 +68,14 @@ def save(self):
6868 for entry in self .entries :
6969 if entry .op == "add" :
7070 if entry .separator == "=" :
71- matchString = "^\ *" + entry .name + ".*"
71+ matchString = r "^\ *" + entry .name + ".*"
7272 elif entry .separator == " " :
73- matchString = "^\ *" + entry .name + "\ *" + entry .value
73+ matchString = r "^\ *" + entry .name + r "\ *" + entry .value
7474 else :
7575 if entry .separator == "=" :
76- matchString = "^\ *" + entry .name + "\ *=\ *" + entry .value
76+ matchString = r "^\ *" + entry .name + r "\ *=\ *" + entry .value
7777 else :
78- matchString = "^\ *" + entry .name + "\ *" + entry .value
78+ matchString = r "^\ *" + entry .name + r "\ *" + entry .value
7979
8080 match = re .match (matchString , line )
8181 if match is not None :
Original file line number Diff line number Diff line change @@ -45,8 +45,11 @@ def getDefaultNetwork():
4545 if not cmd .isSuccess ():
4646 logging .debug ("Failed to get default route" )
4747 raise CloudRuntimeException ("Failed to get default route" )
48-
49- result = cmd .getStdout ().split (" " )
48+ output = cmd .getStdout ().strip ()
49+ result = output .split (" " )
50+ if len (result ) < 2 :
51+ logging .debug ("Output for the default route incomplete: %s. It should have been '<GATEWAY> <DEVICE>'" % output )
52+ raise CloudRuntimeException ("Output for the default route incomplete" )
5053 gateway = result [0 ]
5154 dev = result [1 ]
5255
You can’t perform that action at this time.
0 commit comments