Fix false success when requested instance is not ready.

parent a91e558b
...@@ -119,6 +119,7 @@ class Recipe(object): ...@@ -119,6 +119,7 @@ class Recipe(object):
self._raise_request_exception = None self._raise_request_exception = None
self._raise_request_exception_formatted = None self._raise_request_exception_formatted = None
self.instance = None self.instance = None
# Try to do the request and fetch parameter dict...
try: try:
self.instance = request(software_url, software_type, self.instance = request(software_url, software_type,
name, partition_parameter_kw=partition_parameter_kw, name, partition_parameter_kw=partition_parameter_kw,
...@@ -133,18 +134,14 @@ class Recipe(object): ...@@ -133,18 +134,14 @@ class Recipe(object):
self._raise_request_exception_formatted = traceback.format_exc() self._raise_request_exception_formatted = traceback.format_exc()
return_parameter_dict = {} return_parameter_dict = {}
# Then try to get all the parameters. In case of problem, put empty string.
for param in return_parameters: for param in return_parameters:
options['connection-%s' % param] = '' options['connection-%s' % param] = ''
if not self.instance:
continue
try: try:
value = return_parameter_dict[param] options['connection-%s' % param] = return_parameter_dict[param]
except KeyError: except KeyError:
value = ''
except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady):
if self.failed is None: if self.failed is None:
self.failed = param self.failed = param
options['connection-%s' % param] = value
def _filterForStorage(self, partition_parameter_kw): def _filterForStorage(self, partition_parameter_kw):
return partition_parameter_kw return partition_parameter_kw
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment