Drop param2id() from cmd/manage.py

The function is not used anywhere.

Change-Id: I799e73992faa387e56a793d60cc599039d268f81
This commit is contained in:
Thomas Bechtold 2019-01-03 14:06:00 +01:00
parent 2a27a433d3
commit 0c177b902a
2 changed files with 0 additions and 31 deletions

View File

@ -60,7 +60,6 @@ import sys
from oslo_config import cfg
from oslo_log import log
from oslo_utils import uuidutils
from manila.common import config # Need to register global_opts # noqa
from manila import context
@ -91,20 +90,6 @@ def args(*args, **kwargs):
return _decorator
def param2id(object_id):
"""Helper function to convert various id types to internal id.
args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10'
"""
if uuidutils.is_uuid_like(object_id):
return object_id
elif '-' in object_id:
# FIXME(ja): mapping occurs in nova?
pass
else:
return int(object_id)
class ShellCommands(object):
def bpython(self):
"""Runs a bpython shell.

View File

@ -47,22 +47,6 @@ class ManilaCmdManageTestCase(test.TestCase):
self.service_cmds = manila_manage.ServiceCommands()
self.share_cmds = manila_manage.ShareCommands()
def test_param2id_is_uuid_like(self):
obj_id = '12345678123456781234567812345678'
self.assertEqual(obj_id, manila_manage.param2id(obj_id))
def test_param2id_not_uuid_like_with_dash(self):
obj_id = '112-112-112'
self.assertIsNone(manila_manage.param2id(obj_id))
def test_param2id_not_uuid_like_without_dash(self):
obj_id = '123'
self.assertEqual(123, manila_manage.param2id(obj_id))
def test_param2id_not_uuid_like_value_error(self):
obj_id = 'invalidvalue'
self.assertRaises(ValueError, manila_manage.param2id, obj_id)
@mock.patch.object(manila_manage.ShellCommands, 'run', mock.Mock())
def test_shell_commands_bpython(self):
self.shell_commands.bpython()