Skip to content

Commit b809e89

Browse files
committed
cloudutils: fix warning, error during kvm agent installation
Fixes #10379 Signed-off-by: Abhishek Kumar <[email protected]>
1 parent db5b6a5 commit b809e89

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

python/lib/cloudutils/configFileOps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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:

python/lib/cloudutils/networkConfig.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)