From: Cédric Ollivier Date: Mon, 7 Jan 2019 11:15:24 +0000 (+0100) Subject: Prevent from CloudifyClientError (key already exists) X-Git-Tag: opnfv-9.0.0~104 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F66253%2F1;p=functest.git Prevent from CloudifyClientError (key already exists) It has rarely occured in Orange Openlab [1]. Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/functest/core/cloudify.py", line 70, in execute self.cfy_client.secrets.create("foo", "bar") File "/usr/lib/python2.7/site-packages/cloudify_rest_client/secrets.py", line 86, in create response = self.api.put('/secrets/{0}'.format(key), data=data) File "/usr/lib/python2.7/site-packages/cloudify_rest_client/client.py", line 263, in put timeout=timeout) File "/usr/lib/python2.7/site-packages/cloudify_rest_client/client.py", line 224, in do_request verify=self.get_request_verify(), timeout=timeout) File "/usr/lib/python2.7/site-packages/cloudify_rest_client/client.py", line 158, in _do_request self._raise_client_error(response, request_url) File "/usr/lib/python2.7/site-packages/cloudify_rest_client/client.py", line 119, in _raise_client_error response=response) File "/usr/lib/python2.7/site-packages/cloudify_rest_client/client.py", line 131, in _prepare_and_raise_exception status_code, error_code=error_code, response=response) CloudifyClientError: 409: already exists on Change-Id: Ic61d0c729f13caa552a0b0a00dad35e50d130e01 Signed-off-by: Cédric Ollivier --- diff --git a/functest/core/cloudify.py b/functest/core/cloudify.py index 0428a13b3..daa63e623 100644 --- a/functest/core/cloudify.py +++ b/functest/core/cloudify.py @@ -67,7 +67,8 @@ class Cloudify(singlevm.SingleVm2): "The current manager status is %s", cfy_status) if str(cfy_status) != 'running': raise Exception("Cloudify Manager isn't up and running") - self.cfy_client.secrets.create("foo", "bar") + self.cfy_client.secrets.create( + "foo", "bar", update_if_exists=True) self.__logger.debug( "List secrets: %s", self.cfy_client.secrets.list()) self.cfy_client.secrets.delete("foo")