Don't try to fetch params when request has failed

parent f9378e9b
...@@ -125,6 +125,7 @@ class Recipe(object): ...@@ -125,6 +125,7 @@ class Recipe(object):
librecipe.GenericBaseRecipe.TRUE_VALUES librecipe.GenericBaseRecipe.TRUE_VALUES
self._raise_request_exception = None self._raise_request_exception = None
self.instance = None
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,
...@@ -135,11 +136,13 @@ class Recipe(object): ...@@ -135,11 +136,13 @@ class Recipe(object):
self._raise_request_exception = exc self._raise_request_exception = exc
for param in return_parameters: for param in return_parameters:
options['connection-%s' % param] = ''
if not self.instance:
continue
try: try:
options['connection-%s' % param] = str( options['connection-%s' % param] = str(
self.instance.getConnectionParameter(param)) self.instance.getConnectionParameter(param))
except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady): except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady):
options['connection-%s' % param] = ''
if self.failed is None: if self.failed is None:
self.failed = param self.failed = param
......
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