From 40322bac041a471e2b775e494f1042fd1fbc777a Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 16 Nov 2018 04:18:32 -0600 Subject: [PATCH] Register proxy directly in add_service When adding an unknown service to Connection, the existing code was adding the service's ServiceDescription. Unfortunately, adding a Descriptor at runtime doesn't actually work and the added instance winds up being unusable. As add_service is an active call, we can assume that the person calling it actually wants to use the service, so we don't need to hid it behind an on-demand descriptor. Run _make_proxy directly and attach the resulting proxy to the Connection. Change-Id: I02aa1ebbd11bea33712a3cb82600abc1aed2a65a --- openstack/connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack/connection.py b/openstack/connection.py index 73631d06e..e8fdc9e4d 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -344,10 +344,11 @@ class Connection(six.with_metaclass(_meta.ConnectionMeta, # we get an adapter. if isinstance(service, six.string_types): service = service_description.ServiceDescription(service) + service_proxy = service._make_proxy(self) # Register the proxy class with every known alias for attr_name in service.all_types: - setattr(self, attr_name.replace('-', '_'), service) + setattr(self, attr_name.replace('-', '_'), service_proxy) def authorize(self): """Authorize this Connection