From: Ivan Kolodyazhny Date: Mon, 21 Sep 2015 18:51:35 +0000 (+0300) Subject: Make rpc_client method private for VolumeCommands X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=039767a1efd5cd127e54090d040d9458f65fd47c;p=openstack-build%2Fcinder-build.git Make rpc_client method private for VolumeCommands "rpc_client" is not sub-command and should not be in the help for 'cinder-manage volume' command. Change-Id: Ie94554b3fade09e32269c96fcb4a7d2b91062119 Closes-Bug: #1498136 --- diff --git a/cinder/cmd/manage.py b/cinder/cmd/manage.py index be918fdc8..cd5396c24 100644 --- a/cinder/cmd/manage.py +++ b/cinder/cmd/manage.py @@ -268,7 +268,7 @@ class VolumeCommands(object): def __init__(self): self._client = None - def rpc_client(self): + def _rpc_client(self): if self._client is None: if not rpc.initialized(): rpc.init(CONF) @@ -297,7 +297,7 @@ class VolumeCommands(object): print(_("Detach volume from instance and then try again.")) return - cctxt = self.rpc_client().prepare(server=host) + cctxt = self._rpc_client().prepare(server=host) cctxt.cast(ctxt, "delete_volume", volume_id=volume['id']) @args('--currenthost', required=True, help='Existing volume host name') diff --git a/cinder/tests/unit/test_cmd.py b/cinder/tests/unit/test_cmd.py index 8f0d44602..095000c14 100644 --- a/cinder/tests/unit/test_cmd.py +++ b/cinder/tests/unit/test_cmd.py @@ -428,7 +428,7 @@ class TestCinderManageCmd(test.TestCase): mock_rpc_client = get_client.return_value volume_cmds = cinder_manage.VolumeCommands() - rpc_client = volume_cmds.rpc_client() + rpc_client = volume_cmds._rpc_client() rpc_initialized.assert_called_once_with() rpc_init.assert_called_once_with(CONF)