Skip to content

Commit

Permalink
Updated comments to support basic auth with credentials in HTTP task (n…
Browse files Browse the repository at this point in the history
…utanix#306)

CALM-13856 : https://jira.nutanix.com/browse/CALM-13856
CALM-13793 : https://jira.nutanix.com/browse/CALM-13793

1. Verified support for basic auth with credentials is added through dsl
while creating http task
2. Verified addition of secret headers for basic auth with credentials
and basic auth

(cherry picked from commit 9722c747e84c4e0eea6ea76ce1e8655633916584)
  • Loading branch information
dwivediprab committed Mar 15, 2024
1 parent 7c00d90 commit 0a6c2d9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions calm/dsl/builtins/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,7 @@ def http_task(
"""
auth_obj = {"auth_type": "none"}

# Auth object for basic auth with credential.
if cred is not None:
cred_ref = _get_target_ref(cred)
if getattr(cred_ref, "kind", None) != "app_credential":
Expand All @@ -1386,6 +1387,7 @@ def http_task(
"credential_local_reference": cred_ref,
}

# Auth object for basic auth
elif credential is not None:
if getattr(credential, "__kind__", None) != "app_credential":
raise ValueError(
Expand All @@ -1394,10 +1396,6 @@ def http_task(
+ " should be a Credential object of PASSWORD type"
)

# TODO: Auth should be changed to basic auth with credential.
# This is dependent on https://jira.nutanix.com/browse/CALM-12149
# We could also possibly check calm server version to switch between
# the two auth mechanisms since basic auth will be deprecated.
auth_obj = {
"auth_type": "basic",
"basic_auth": {
Expand Down

0 comments on commit 0a6c2d9

Please sign in to comment.