diff --git a/novaclient/client.py b/novaclient/client.py index 441114185..c5590e7c8 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -688,11 +688,9 @@ def _construct_http_client(api_version=None, cacert=None, connection_pool=False, endpoint_type='publicURL', - extensions=None, http_log_debug=False, insecure=False, interface=None, - no_cache=True, os_cache=False, password=None, project_id=None, @@ -876,6 +874,11 @@ def Client(version, username=None, api_key=None, project_id=None, _check_arguments(kwargs, "Ocata", "auth_plugin") _check_arguments(kwargs, "Ocata", "auth_system") + if "no_cache" in kwargs: + _check_arguments(kwargs, "Ocata", "no_cache", "os_cache") + # os_cache is not a fully compatible with no_cache, so we need to + # apply this custom processing + kwargs["os_cache"] = not kwargs["os_cache"] api_version, client_class = _get_client_class_and_version(version) kwargs.pop("direct_use", None) diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py index b559882fe..945749d54 100644 --- a/novaclient/tests/unit/test_client.py +++ b/novaclient/tests/unit/test_client.py @@ -184,18 +184,6 @@ class ClientTest(utils.TestCase): self.assertFalse(cs.os_cache) self.assertFalse(cs.client.os_cache) - def test_client_with_no_cache_enabled(self): - cs = novaclient.client.Client("2", "user", "password", "project_id", - auth_url="foo/v2", no_cache=True) - self.assertFalse(cs.os_cache) - self.assertFalse(cs.client.os_cache) - - def test_client_with_no_cache_disabled(self): - cs = novaclient.client.Client("2", "user", "password", "project_id", - auth_url="foo/v2", no_cache=False) - self.assertTrue(cs.os_cache) - self.assertTrue(cs.client.os_cache) - def test_client_set_management_url_v1_1(self): cs = novaclient.client.Client("2", "user", "password", "project_id", auth_url="foo/v2") diff --git a/novaclient/v2/client.py b/novaclient/v2/client.py index 717727f46..e86d8cf02 100644 --- a/novaclient/v2/client.py +++ b/novaclient/v2/client.py @@ -82,7 +82,6 @@ class Client(object): http_log_debug=False, insecure=False, logger=None, - no_cache=True, os_cache=False, project_id=None, proxy_tenant_id=None, @@ -116,7 +115,6 @@ class Client(object): :param bool insecure: Allow insecure :param logging.Logger logger: Logger instance to be used for all logging stuff - :param bool no_cache: No cache :param bool os_cache: OS cache :param str project_id: Project ID :param str proxy_tenant_id: Tenant ID @@ -191,7 +189,7 @@ class Client(object): self.services = services.ServiceManager(self) self.fixed_ips = fixed_ips.FixedIPsManager(self) self.floating_ips_bulk = floating_ips_bulk.FloatingIPBulkManager(self) - self.os_cache = os_cache or not no_cache + self.os_cache = os_cache self.availability_zones = \ availability_zones.AvailabilityZoneManager(self) self.server_groups = server_groups.ServerGroupsManager(self) diff --git a/releasenotes/notes/deprecate-no-cache-arg-7814806b4f79c1b9.yaml b/releasenotes/notes/deprecate-no-cache-arg-7814806b4f79c1b9.yaml new file mode 100644 index 000000000..2fc9e4bfc --- /dev/null +++ b/releasenotes/notes/deprecate-no-cache-arg-7814806b4f79c1b9.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - novaclient.client.Client entry-point accepted two arguments with same + meaning (**no_cache** and **os_cache**). Since **os_cache** is more widely + used in our code, **no_cache** was deprecated.