From f3b7b972ddea69649cfa6c79cad5a4220a2588c7 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 14 Feb 2019 14:16:14 +0000 Subject: [PATCH] Address nits from I9e30a24a4c0640f282f507d0a96640d3cdefe43c Change-Id: I0315e85a05c9faced339c3dd1fbb747c1c803add Signed-off-by: Stephen Finucane --- nova/conf/cinder.py | 2 +- nova/conf/serial_console.py | 2 +- nova/utils.py | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nova/conf/cinder.py b/nova/conf/cinder.py index 8e91b9c2e165..d0e2a8841c3b 100644 --- a/nova/conf/cinder.py +++ b/nova/conf/cinder.py @@ -24,7 +24,7 @@ cinder_group = cfg.OptGroup( cinder_opts = [ cfg.StrOpt('catalog_info', default='volumev3::publicURL', - regex='^(\w+):(\w*):(.*?)$', + regex=r'^\w+:\w*:.*$', help=""" Info to match when looking for cinder in the service catalog. diff --git a/nova/conf/serial_console.py b/nova/conf/serial_console.py index 7faf8ede9dc3..233aa70faedf 100644 --- a/nova/conf/serial_console.py +++ b/nova/conf/serial_console.py @@ -35,7 +35,7 @@ This service is typically executed on the controller node. """), cfg.StrOpt('port_range', default=DEFAULT_PORT_RANGE, - regex="^\d+:\d+$", + regex=r'^\d+:\d+$', help=""" A range of TCP ports a guest can use for its backend. diff --git a/nova/utils.py b/nova/utils.py index 2571cf3239dd..1e4fb8e390d7 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -292,8 +292,6 @@ def last_completed_audit_period(unit=None, before=None): rightnow = before else: rightnow = timeutils.utcnow() - if unit not in ('month', 'day', 'year', 'hour'): - raise ValueError(_('Time period must be hour, day, month or year')) if unit == 'month': if offset == 0: offset = 1 @@ -343,7 +341,7 @@ def last_completed_audit_period(unit=None, before=None): end = end - datetime.timedelta(days=1) begin = end - datetime.timedelta(days=1) - elif unit == 'hour': + else: # unit == 'hour' end = rightnow.replace(minute=offset, second=0, microsecond=0) if end >= rightnow: end = end - datetime.timedelta(hours=1)