mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-25 17:22:33 +02:00
cloudutils: fix warning, error during kvm agent installation (#11318)
* cloudutils: fix warning, error during kvm agent installation Fixes #10379 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * Update utilities.py --------- Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
b82369c241
commit
eee43e534f
@ -68,14 +68,14 @@ class configFileOps:
|
||||
for entry in self.entries:
|
||||
if entry.op == "add":
|
||||
if entry.separator == "=":
|
||||
matchString = "^\ *" + entry.name + ".*"
|
||||
matchString = r"^\ *" + entry.name + ".*"
|
||||
elif entry.separator == " ":
|
||||
matchString = "^\ *" + entry.name + "\ *" + entry.value
|
||||
matchString = r"^\ *" + entry.name + r"\ *" + entry.value
|
||||
else:
|
||||
if entry.separator == "=":
|
||||
matchString = "^\ *" + entry.name + "\ *=\ *" + entry.value
|
||||
matchString = r"^\ *" + entry.name + r"\ *=\ *" + entry.value
|
||||
else:
|
||||
matchString = "^\ *" + entry.name + "\ *" + entry.value
|
||||
matchString = r"^\ *" + entry.name + r"\ *" + entry.value
|
||||
|
||||
match = re.match(matchString, line)
|
||||
if match is not None:
|
||||
|
||||
@ -45,8 +45,11 @@ class networkConfig:
|
||||
if not cmd.isSuccess():
|
||||
logging.debug("Failed to get default route")
|
||||
raise CloudRuntimeException("Failed to get default route")
|
||||
|
||||
result = cmd.getStdout().split(" ")
|
||||
output = cmd.getStdout().strip()
|
||||
result = output.split(" ")
|
||||
if len(result) < 2:
|
||||
logging.debug("Output for the default route incomplete: %s. It should have been '<GATEWAY> <DEVICE>'" % output)
|
||||
raise CloudRuntimeException("Output for the default route incomplete")
|
||||
gateway = result[0]
|
||||
dev = result[1]
|
||||
|
||||
@ -150,10 +153,10 @@ class networkConfig:
|
||||
if line.find("HWaddr") != -1:
|
||||
macAddr = line.split("HWaddr ")[1].strip(" ")
|
||||
elif line.find("inet ") != -1:
|
||||
m = re.search("addr:(.*)\ *Bcast:(.*)\ *Mask:(.*)", line)
|
||||
m = re.search(r"addr:([^\s]+)\s*Bcast:([^\s]+)\s*Mask:([^\s]+)", line)
|
||||
if m is not None:
|
||||
ipAddr = m.group(1).rstrip(" ")
|
||||
netmask = m.group(3).rstrip(" ")
|
||||
ipAddr = m.group(1).strip()
|
||||
netmask = m.group(3).strip()
|
||||
|
||||
if networkConfig.isBridgePort(dev):
|
||||
type = "brport"
|
||||
|
||||
@ -63,7 +63,7 @@ class bash:
|
||||
return self.stdout.decode('utf-8').strip('\n')
|
||||
|
||||
def getLines(self):
|
||||
return self.stdout.decode('utf-8').strip('\n')
|
||||
return self.stdout.decode('utf-8').strip('\n').split('\n')
|
||||
|
||||
def getStderr(self):
|
||||
return self.stderr.decode('utf-8').strip('\n')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user