Remove deprecated properties of OpenStackCredentials
Change-Id: I040e20508333b816af6a890c7a667af74cef00b5
This commit is contained in:
@@ -39,6 +39,9 @@ Removed
|
||||
(see ``rally_openstack.services`` module for more details)
|
||||
while developing custom plugins. All the inner plugins used
|
||||
the new code for a long time.
|
||||
* Remove deprecated properties *insecure*, *cacert* (use *https_insecure* and
|
||||
*https_cacert* properties instead) and method *list_services* (use
|
||||
appropriate method of Clients object) of OpenStackCredentials object.
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
||||
@@ -60,36 +60,15 @@ class OpenStackCredential(dict):
|
||||
# object as raw dict as soon as we clean over code.
|
||||
return self.get(attr, default)
|
||||
|
||||
# backward compatibility
|
||||
@property
|
||||
def insecure(self):
|
||||
LOG.warning("Property 'insecure' is deprecated since Rally 0.10.0. "
|
||||
"Use 'https_insecure' instead.")
|
||||
return self["https_insecure"]
|
||||
|
||||
# backward compatibility
|
||||
@property
|
||||
def cacert(self):
|
||||
LOG.warning("Property 'cacert' is deprecated since Rally 0.10.0. "
|
||||
"Use 'https_cacert' instead.")
|
||||
return self["https_cacert"]
|
||||
|
||||
def to_dict(self):
|
||||
return dict(self)
|
||||
|
||||
def list_services(self):
|
||||
LOG.warning("Method `list_services` of OpenStackCredentials is "
|
||||
"deprecated since Rally 0.11.0. Use osclients instead.")
|
||||
return sorted([{"type": stype, "name": sname}
|
||||
for stype, sname in self.clients().services().items()],
|
||||
key=lambda s: s["name"])
|
||||
def __deepcopy__(self, memodict=None):
|
||||
import copy
|
||||
return self.__class__(**copy.deepcopy(self.to_dict()))
|
||||
|
||||
# this method is mostly used by validation step. let's refactor it and
|
||||
# deprecated this
|
||||
def clients(self, api_info=None):
|
||||
return osclients.Clients(self, api_info=api_info,
|
||||
cache=self._clients_cache)
|
||||
|
||||
def __deepcopy__(self, memodict=None):
|
||||
import copy
|
||||
return self.__class__(**copy.deepcopy(self.to_dict()))
|
||||
|
||||
@@ -45,17 +45,6 @@ class OpenStackCredentialTestCase(test.TestCase):
|
||||
"profiler_conn_str": None},
|
||||
self.credential.to_dict())
|
||||
|
||||
@mock.patch("rally_openstack.osclients.Clients")
|
||||
def test_list_services(self, mock_clients):
|
||||
mock_clients.return_value.services.return_value = {"compute": "nova",
|
||||
"volume": "cinder"}
|
||||
result = self.credential.list_services()
|
||||
mock_clients.assert_called_once_with(
|
||||
self.credential, api_info=None, cache={})
|
||||
mock_clients.return_value.services.assert_called_once_with()
|
||||
self.assertEqual([{"name": "cinder", "type": "volume"},
|
||||
{"name": "nova", "type": "compute"}], result)
|
||||
|
||||
@mock.patch("rally_openstack.osclients.Clients")
|
||||
def test_clients(self, mock_clients):
|
||||
clients = self.credential.clients(api_info="fake_info")
|
||||
|
||||
@@ -812,7 +812,7 @@ class OSClientsTestCase(test.TestCase):
|
||||
"url": "http://fake.to:1/fake",
|
||||
"aws_access_key_id": "fake_access",
|
||||
"aws_secret_access_key": "fake_secret",
|
||||
"is_secure": self.credential.insecure,
|
||||
"is_secure": self.credential.https_insecure,
|
||||
}
|
||||
mock_boto.connect_ec2_endpoint.assert_called_once_with(**kw)
|
||||
self.assertEqual(fake_ec2, self.clients.cache["ec2"])
|
||||
|
||||
Reference in New Issue
Block a user