summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bechtold <tbechtold@suse.com>2019-01-03 14:06:00 +0100
committerThomas Bechtold <tbechtold@suse.com>2019-01-03 14:10:01 +0100
commit0c177b902a5799dfe2f026b67094d12081f31045 (patch)
treeb8d52b1e9c1d3c235c842459e639b659c253bf21
parent2a27a433d3f579c731c13ef05b89ba4943e204d5 (diff)
Drop param2id() from cmd/manage.py
The function is not used anywhere. Change-Id: I799e73992faa387e56a793d60cc599039d268f81
Notes
Notes (review): Code-Review+2: Tom Barron <tpb@dyncloud.net> Code-Review+2: Rodrigo Barbieri <rodrigo.barbieri2010@gmail.com> Workflow+1: Rodrigo Barbieri <rodrigo.barbieri2010@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 03 Jan 2019 16:01:11 +0000 Reviewed-on: https://review.openstack.org/628174 Project: openstack/manila Branch: refs/heads/master
-rw-r--r--manila/cmd/manage.py15
-rw-r--r--manila/tests/cmd/test_manage.py16
2 files changed, 0 insertions, 31 deletions
diff --git a/manila/cmd/manage.py b/manila/cmd/manage.py
index 41907b7..a9cb726 100644
--- a/manila/cmd/manage.py
+++ b/manila/cmd/manage.py
@@ -60,7 +60,6 @@ import sys
60 60
61from oslo_config import cfg 61from oslo_config import cfg
62from oslo_log import log 62from oslo_log import log
63from oslo_utils import uuidutils
64 63
65from manila.common import config # Need to register global_opts # noqa 64from manila.common import config # Need to register global_opts # noqa
66from manila import context 65from manila import context
@@ -91,20 +90,6 @@ def args(*args, **kwargs):
91 return _decorator 90 return _decorator
92 91
93 92
94def param2id(object_id):
95 """Helper function to convert various id types to internal id.
96
97 args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10'
98 """
99 if uuidutils.is_uuid_like(object_id):
100 return object_id
101 elif '-' in object_id:
102 # FIXME(ja): mapping occurs in nova?
103 pass
104 else:
105 return int(object_id)
106
107
108class ShellCommands(object): 93class ShellCommands(object):
109 def bpython(self): 94 def bpython(self):
110 """Runs a bpython shell. 95 """Runs a bpython shell.
diff --git a/manila/tests/cmd/test_manage.py b/manila/tests/cmd/test_manage.py
index f50769f..b333ac9 100644
--- a/manila/tests/cmd/test_manage.py
+++ b/manila/tests/cmd/test_manage.py
@@ -47,22 +47,6 @@ class ManilaCmdManageTestCase(test.TestCase):
47 self.service_cmds = manila_manage.ServiceCommands() 47 self.service_cmds = manila_manage.ServiceCommands()
48 self.share_cmds = manila_manage.ShareCommands() 48 self.share_cmds = manila_manage.ShareCommands()
49 49
50 def test_param2id_is_uuid_like(self):
51 obj_id = '12345678123456781234567812345678'
52 self.assertEqual(obj_id, manila_manage.param2id(obj_id))
53
54 def test_param2id_not_uuid_like_with_dash(self):
55 obj_id = '112-112-112'
56 self.assertIsNone(manila_manage.param2id(obj_id))
57
58 def test_param2id_not_uuid_like_without_dash(self):
59 obj_id = '123'
60 self.assertEqual(123, manila_manage.param2id(obj_id))
61
62 def test_param2id_not_uuid_like_value_error(self):
63 obj_id = 'invalidvalue'
64 self.assertRaises(ValueError, manila_manage.param2id, obj_id)
65
66 @mock.patch.object(manila_manage.ShellCommands, 'run', mock.Mock()) 50 @mock.patch.object(manila_manage.ShellCommands, 'run', mock.Mock())
67 def test_shell_commands_bpython(self): 51 def test_shell_commands_bpython(self):
68 self.shell_commands.bpython() 52 self.shell_commands.bpython()