Make Heat and Neutron clients creation lazy (just-in-time).
Change-Id: I14bf6b9271d81049a954946640be4c6dc7a1eb85
This commit is contained in:
parent
0f82027663
commit
7808957452
|
@ -18,7 +18,15 @@ class NetworkManager(object):
|
|||
"""Manages Neutron Resources."""
|
||||
|
||||
def __init__(self, client_manager):
|
||||
self.client = client_manager.neutron_client
|
||||
self._client_manager = client_manager
|
||||
|
||||
_client = None
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
if not self._client:
|
||||
self._client = self._client_manager.network_client
|
||||
return self._client
|
||||
|
||||
def create_sg_rules(self, rules, sg_id):
|
||||
"""Creates security group rules."""
|
||||
|
|
|
@ -41,10 +41,18 @@ class StackManager(object):
|
|||
"""Manages Heat stacks."""
|
||||
|
||||
def __init__(self, client_manager, templates_dir, wait_interval=5):
|
||||
self.client = client_manager.heat_client
|
||||
self._client_manager = client_manager
|
||||
self.templates_dir = templates_dir
|
||||
self.wait_interval = wait_interval
|
||||
|
||||
_client = None
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
if not self._client:
|
||||
self._client = self._client_manager.heat_client
|
||||
return self._client
|
||||
|
||||
def load_template(self, template_path):
|
||||
"""Loads template from a given file."""
|
||||
_, template = template_utils.get_template_contents(template_path)
|
||||
|
|
Loading…
Reference in New Issue