calm-dsl icon indicating copy to clipboard operation
calm-dsl copied to clipboard

Fix Azure environment credential reference for readiness probe.

Open glover-chris opened this issue 3 years ago • 0 comments

Have a workaround thus far adding this code to the environments.py. Abhijeet is aware of the issue.

Adding uuid to creds and substrates

cred_name_uuid_map = {}
for cred in env_payload["spec"]["resources"].get("credential_definition_list", []):
    cred["uuid"] = str(uuid.uuid4())
    cred_name_uuid_map[cred["name"]] = cred["uuid"]

for sub in env_payload["spec"]["resources"]["substrate_definition_list"]:
    try:
        cred_ref_obj = sub["readiness_probe"]["login_credential_local_reference"]
        cred_ref_obj["uuid"] = cred_name_uuid_map[cred_ref_obj["name"]]
    except Exception:
        pass

glover-chris avatar Sep 27 '21 14:09 glover-chris