summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorHironori Shiina <shiina.hironori@jp.fujitsu.com>2016-08-11 00:02:29 +0900
committerHironori Shiina <shiina.hironori@jp.fujitsu.com>2016-09-11 21:48:23 +0900
commitd6f99b721d3e3978fd6a5438bdacefd5840d3b02 (patch)
tree7ece21caace8b7eae5379572a87042c600d9112c /openstackclient/compute
parentd2273ecea5d540f4dacc89772870722355f2492f (diff)
downloadpython-openstackclient-d6f99b721d3e3978fd6a5438bdacefd5840d3b02.tar.gz
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
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/hypervisor.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openstackclient/compute/v2/hypervisor.py b/openstackclient/compute/v2/hypervisor.py
index 00625050..f9051919 100644
--- a/openstackclient/compute/v2/hypervisor.py
+++ b/openstackclient/compute/v2/hypervisor.py
@@ -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)