mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +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:
|
for entry in self.entries:
|
||||||
if entry.op == "add":
|
if entry.op == "add":
|
||||||
if entry.separator == "=":
|
if entry.separator == "=":
|
||||||
matchString = "^\ *" + entry.name + ".*"
|
matchString = r"^\ *" + entry.name + ".*"
|
||||||
elif entry.separator == " ":
|
elif entry.separator == " ":
|
||||||
matchString = "^\ *" + entry.name + "\ *" + entry.value
|
matchString = r"^\ *" + entry.name + r"\ *" + entry.value
|
||||||
else:
|
else:
|
||||||
if entry.separator == "=":
|
if entry.separator == "=":
|
||||||
matchString = "^\ *" + entry.name + "\ *=\ *" + entry.value
|
matchString = r"^\ *" + entry.name + r"\ *=\ *" + entry.value
|
||||||
else:
|
else:
|
||||||
matchString = "^\ *" + entry.name + "\ *" + entry.value
|
matchString = r"^\ *" + entry.name + r"\ *" + entry.value
|
||||||
|
|
||||||
match = re.match(matchString, line)
|
match = re.match(matchString, line)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
|
|||||||
@ -45,8 +45,11 @@ class networkConfig:
|
|||||||
if not cmd.isSuccess():
|
if not cmd.isSuccess():
|
||||||
logging.debug("Failed to get default route")
|
logging.debug("Failed to get default route")
|
||||||
raise CloudRuntimeException("Failed to get default route")
|
raise CloudRuntimeException("Failed to get default route")
|
||||||
|
output = cmd.getStdout().strip()
|
||||||
result = cmd.getStdout().split(" ")
|
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]
|
gateway = result[0]
|
||||||
dev = result[1]
|
dev = result[1]
|
||||||
|
|
||||||
@ -150,10 +153,10 @@ class networkConfig:
|
|||||||
if line.find("HWaddr") != -1:
|
if line.find("HWaddr") != -1:
|
||||||
macAddr = line.split("HWaddr ")[1].strip(" ")
|
macAddr = line.split("HWaddr ")[1].strip(" ")
|
||||||
elif line.find("inet ") != -1:
|
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:
|
if m is not None:
|
||||||
ipAddr = m.group(1).rstrip(" ")
|
ipAddr = m.group(1).strip()
|
||||||
netmask = m.group(3).rstrip(" ")
|
netmask = m.group(3).strip()
|
||||||
|
|
||||||
if networkConfig.isBridgePort(dev):
|
if networkConfig.isBridgePort(dev):
|
||||||
type = "brport"
|
type = "brport"
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class bash:
|
|||||||
return self.stdout.decode('utf-8').strip('\n')
|
return self.stdout.decode('utf-8').strip('\n')
|
||||||
|
|
||||||
def getLines(self):
|
def getLines(self):
|
||||||
return self.stdout.decode('utf-8').strip('\n')
|
return self.stdout.decode('utf-8').strip('\n').split('\n')
|
||||||
|
|
||||||
def getStderr(self):
|
def getStderr(self):
|
||||||
return self.stderr.decode('utf-8').strip('\n')
|
return self.stderr.decode('utf-8').strip('\n')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user