Merge "Handle single digit versions"
This commit is contained in:
@@ -18,6 +18,8 @@ import logging
|
||||
import re
|
||||
import warnings
|
||||
|
||||
from oslo_utils import strutils
|
||||
|
||||
import manilaclient
|
||||
from manilaclient.common._i18n import _
|
||||
from manilaclient.common import cliutils
|
||||
@@ -231,6 +233,8 @@ def check_version_deprecated(api_version):
|
||||
def get_api_version(version_string):
|
||||
"""Returns checked APIVersion object."""
|
||||
version_string = str(version_string)
|
||||
if strutils.is_int_like(version_string):
|
||||
version_string = f"{version_string}.0"
|
||||
|
||||
api_version = APIVersion(version_string)
|
||||
check_version_supported(api_version)
|
||||
|
||||
@@ -121,7 +121,7 @@ def build_option_parser(parser):
|
||||
),
|
||||
help='Shared File System API version, default='
|
||||
+ default_api_version
|
||||
+ 'version supported by both the client and the server). '
|
||||
+ ' (version supported by both the client and the server) '
|
||||
'(Env: OS_SHARE_API_VERSION)',
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -144,11 +144,6 @@ class GetAPIVersionTestCase(utils.TestCase):
|
||||
"something_wrong",
|
||||
)
|
||||
|
||||
def test_wrong_major_version(self):
|
||||
self.assertRaises(
|
||||
exceptions.UnsupportedVersion, api_versions.get_api_version, "1"
|
||||
)
|
||||
|
||||
@mock.patch("manilaclient.api_versions.APIVersion")
|
||||
def test_major_and_minor_parts_is_presented(self, mock_apiversion):
|
||||
version = "2.7"
|
||||
|
||||
Reference in New Issue
Block a user