Fix regular expression for uptime in hypervisor show
Hypervisor show command has a few bugs as follows. - It doesn't trim an extra whitespace in the head of uptime information. - It doesn't display uptime information when the number of user is 1. This patch fixes the regular expression to match uptime information. Change-Id: Ic2f7fd9a9274466717084a0886f95f78e98a9007 Closes-Bug: 1611809
This commit is contained in:
openstackclient
@ -98,8 +98,9 @@ class ShowHypervisor(command.ShowOne):
|
||||
# Extract data from uptime value
|
||||
# format: 0 up 0, 0 users, load average: 0, 0, 0
|
||||
# example: 17:37:14 up 2:33, 3 users, load average: 0.33, 0.36, 0.34
|
||||
m = re.match("(.+)\sup\s+(.+),\s+(.+)\susers,\s+load average:\s(.+)",
|
||||
uptime['uptime'])
|
||||
m = re.match(
|
||||
"\s*(.+)\sup\s+(.+),\s+(.+)\susers?,\s+load average:\s(.+)",
|
||||
uptime['uptime'])
|
||||
if m:
|
||||
hypervisor["host_time"] = m.group(1)
|
||||
hypervisor["uptime"] = m.group(2)
|
||||
|
Reference in New Issue
Block a user