Skip to content

Commit

Permalink
Multiple tickets resolved related to 3.7.0 (#255)
Browse files Browse the repository at this point in the history
Description:
1. Added service account auth key in describe_k8s_account (Issue Link :
https://jira.nutanix.com/browse/CALM-39091)
2. Fixed create policy description
3. Removed PRE_CREATE option as it is unavailable in PC
4. Fixed UUID None error while approving single request using dsl (Issue
link: https://jira.nutanix.com/browse/CALM-39149)

![image](https://github.com/ideadevice/calm-dsl/assets/123161845/bb42c694-4e2f-4d77-964c-656ba3a43d3b)

<img width="628" alt="image"
src="https://github.com/ideadevice/calm-dsl/assets/123161845/58329f07-9697-4ae5-abf6-ab8af0f04e70">

<img width="1077" alt="image"
src="https://github.com/ideadevice/calm-dsl/assets/123161845/25176a86-e812-4706-9d97-7746405f8ced">

(cherry picked from commit 499e66a43ac1dc84b85e6a4dd894578ae43fa559)
  • Loading branch information
dwivediprab authored and abhijeetkaurav1st committed Aug 16, 2023
1 parent 21a4ab6 commit 6df322d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion calm/dsl/builtins/models/policy_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

POLICY_EVENT_MAP = {
POLICY.EVENT.APP.LAUNCH: "APP_LAUNCH",
POLICY.EVENT.APP.PRE_CREATE: "APP_PRE_CREATE",
POLICY.EVENT.APP.DAY_TWO_OPERATION: "APP_DAY_TWO_OPERATION",
POLICY.EVENT.RUNBOOK.EXECUTE: "RUNBOOK_EXECUTE",
}
Expand Down
1 change: 1 addition & 0 deletions calm/dsl/cli/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ def describe_k8s_account(spec):
"basic": "Basic Auth",
"client_certificate": "Client Certificate",
"ca_certificate": "CA Certificate",
"service_account": "Service Account",
}

auth = spec["authentication"]
Expand Down
9 changes: 8 additions & 1 deletion calm/dsl/cli/approval.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,19 @@ def update_approval_command(name, state, comment="", uuid=""):
approval_res = approval.get("status", {}).get("resources", {})
approval_state = approval_res.get("state", "DRAFT")

# in case of single request from approval we need to fetch uuid explicitly from metadata
if not uuid:
approval = get_approval(client, name, uuid)
approval_uuid = approval["metadata"]["uuid"]
else:
approval_uuid = uuid

ContextObj = get_context()
server_config = ContextObj.get_server_config()
pc_ip = server_config["pc_ip"]
pc_port = server_config["pc_port"]
link = "https://{}:{}/console/#page/explore/calm/policies/approvals/requests/{}".format(
pc_ip, pc_port, uuid
pc_ip, pc_port, approval_uuid
)
stdout_dict = {"name": approval_name, "link": link, "state": approval_state}
click.echo(
Expand Down
6 changes: 3 additions & 3 deletions calm/dsl/cli/policy_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def _get_policy_list(name, filter_by, limit, offset, quiet, all_items, out):
required=True,
help="Path of Policy file to upload",
)
@click.option("--name", "-n", default=None, help="Job name (Optional)")
@click.option("--description", default=None, help="Job description (Optional)")
@click.option("--name", "-n", default=None, help="Policy name (Optional)")
@click.option("--description", default=None, help="Policy description (Optional)")
@click.option(
"--force",
"-fc",
Expand All @@ -76,7 +76,7 @@ def _get_policy_list(name, filter_by, limit, offset, quiet, all_items, out):
help="",
)
def _create_policy_command(policy_file, name, description, force):
"""Creates a job in scheduler"""
"""Create a policy"""

create_policy_command(policy_file, name, description, force)

Expand Down
1 change: 0 additions & 1 deletion calm/dsl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class EVENT:
class APP:
LAUNCH = "LAUNCH"
DAY_TWO_OPERATION = "DAY_TWO_OPERATION"
PRE_CREATE = "PRE_CREATE"

class RUNBOOK:
EXECUTE = "EXECUTE"
Expand Down

0 comments on commit 6df322d

Please sign in to comment.