Handle error for missing minor api version
Change the api version regex to forbid empty minor versions, thereby ensuring that manilaclient raises an UnsupportedVersion exception as one would expect in this case. Change-Id: I93268b15ec0b5ee95ea3599bb75bf6fa364e0b91 Closes-Bug: #1590409
This commit is contained in:
parent
ef38f0565c
commit
0cf64700c3
@ -49,7 +49,7 @@ class APIVersion(object):
|
||||
self.ver_minor = 0
|
||||
|
||||
if version_str is not None:
|
||||
match = re.match(r"^([1-9]\d*)\.([1-9]\d*|0|)$", version_str)
|
||||
match = re.match(r"^([1-9]\d*)\.([1-9]\d*|0)$", version_str)
|
||||
if match:
|
||||
self.ver_major = int(match.group(1))
|
||||
self.ver_minor = int(match.group(2))
|
||||
|
@ -54,6 +54,7 @@ class APIVersionTestCase(utils.TestCase):
|
||||
"",
|
||||
" 2.1",
|
||||
"2.1 ",
|
||||
"2.",
|
||||
)
|
||||
def test_invalid_version_strings(self, version):
|
||||
self.assertRaises(exceptions.UnsupportedVersion,
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Added proper error handling for missing API minor version number.
|
Loading…
Reference in New Issue
Block a user