Skip to content

Commit

Permalink
Merge pull request #284 from nutanix/dsl-release/3.7.2.1
Browse files Browse the repository at this point in the history
Calm-DSL support for Calm-3.7.2.1
  • Loading branch information
abhijeetkaurav1st authored Jan 25, 2024
2 parents 5b6cf23 + 8e66227 commit 5682f94
Show file tree
Hide file tree
Showing 99 changed files with 3,428 additions and 360 deletions.
19 changes: 19 additions & 0 deletions calm/dsl/api/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def __init__(self, connection):
self.DOWNLOAD_RUNLOG = self.ITEM + "/app_runlogs/{}/output/download"
self.ACTION_VARIABLE = self.ITEM + "/actions/{}/variables"
self.RECOVERY_GROUPS_LIST = self.ITEM + "/recovery_groups/list"
self.BLUEPRINTS_ORIGINAL = self.ITEM + "/blueprints/original"
self.BLUEPRINT_ENTITIES_ESCRIPT_UPDATE = (
self.ITEM + "/blueprints/entities/update"
)

def run_action(self, app_id, action_id, payload):
return self.connection._call(
Expand All @@ -20,6 +24,21 @@ def run_action(self, app_id, action_id, payload):
method=REQUEST.METHOD.POST,
)

def blueprints_original(self, app_id):
return self.connection._call(
self.BLUEPRINTS_ORIGINAL.format(app_id),
verify=False,
method=REQUEST.METHOD.GET,
)

def blueprints_entities_update(self, app_id, payload):
return self.connection._call(
self.BLUEPRINT_ENTITIES_ESCRIPT_UPDATE.format(app_id),
request_json=payload,
verify=False,
method=REQUEST.METHOD.PUT,
)

def run_patch(self, app_id, patch_id, payload):
return self.connection._call(
self.PATCH_RUN.format(app_id, patch_id),
Expand Down
9 changes: 8 additions & 1 deletion calm/dsl/builtins/models/calm_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,14 @@ def compile(cls, name=None, **kwargs):
"uuid": cache_cluster_data["uuid"],
}
else:
cdict = AhvCluster(name).compile()
# set parent as it is used during cluster check for whitelisting
cluster_entity = AhvCluster(name)
try:
cluster_entity.__parent__ = cls.__parent__
except:
pass

cdict = cluster_entity.compile()
return {
"kind": "cluster",
"name": cdict["name"],
Expand Down
2 changes: 1 addition & 1 deletion calm/dsl/builtins/models/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def decompile(mcls, cdict, context=[], prefix=""):
elif package_type == "SUBSTRATE_IMAGE":
disk_pkg_data = {
"name": cdict["name"],
"description": cdict["description"],
"description": cdict.get("description", ""),
"options": cdict["options"],
}
types = EntityTypeBase.get_entity_types()
Expand Down
12 changes: 12 additions & 0 deletions calm/dsl/builtins/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ def pre_decompile(mcls, cdict, context, prefix=""):
{"kind": "environment", "uuid": _eid} for _eid in env_uuids
]

# Dont support decompilation for other providers
configs = {"snapshot_config_list": [], "restore_config_list": []}
for _config in cdict.get("snapshot_config_list", []):
if _config.get("type") == "AHV_SNAPSHOT":
configs["snapshot_config_list"].append(_config)

for _config in cdict.get("restore_config_list", []):
if _config.get("type") == "AHV_RESTORE":
configs["restore_config_list"].append(_config)

cdict.update(configs)

return cdict

def compile(cls):
Expand Down
3 changes: 2 additions & 1 deletion calm/dsl/builtins/models/substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def get_referenced_account_uuid(cls):
if cls_deployment.substrate.name != str(cls):
continue

environment = getattr(cls_profile, "environment", {})
profile_envs = getattr(cls_profile, "environments", [])
environment = profile_envs[0].get_dict() if profile_envs else dict()
if environment:
LOG.debug(
"Found environment {} associated to app-profile {}".format(
Expand Down
Loading

0 comments on commit 5682f94

Please sign in to comment.