summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/core/cloudify.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/functest/core/cloudify.py b/functest/core/cloudify.py
index 47d1f4e25..83dd603ad 100644
--- a/functest/core/cloudify.py
+++ b/functest/core/cloudify.py
@@ -59,6 +59,8 @@ class Cloudify(singlevm.SingleVm2):
username='admin', password='admin', tenant='default_tenant',
api_version='v3')
self.__logger.info("Attemps running status of the Manager")
+ secret_key = "foo"
+ secret_value = "bar"
for loop in range(10):
try:
self.__logger.debug(
@@ -68,11 +70,16 @@ 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", update_if_exists=True)
- self.__logger.debug(
- "List secrets: %s", self.cfy_client.secrets.list())
- self.cfy_client.secrets.delete("foo")
+ for secret in iter(self.cfy_client.secrets.list()):
+ if secret_key == secret["key"]:
+ self.__logger.debug("Updating secrets: %s", secret_key)
+ self.cfy_client.secrets.update(
+ secret_key, secret_value)
+ break
+ else:
+ self.__logger.debug("Creating secrets: %s", secret_key)
+ self.cfy_client.secrets.create(secret_key, secret_value)
+ self.cfy_client.secrets.delete(secret_key)
self.__logger.info("Secrets API successfully reached")
break
except Exception: # pylint: disable=broad-except