calm-dsl
calm-dsl copied to clipboard
Add new interface for Task inside variables
Right now, CalmTask is supported inside variables. Even in Runbook, we need to import CalmTask for runbook dynanic variables. Ex:
from calm.dsl.runbooks import runbook, runbook_json
from calm.dsl.runbooks import RunbookTask, RunbookVariable as Variable
from calm.dsl.builtins import CalmTask
@runbook
def DslCommunityRunbook():
ntnx_calm_object = Variable.WithOptions.FromTask(
CalmTask.HTTP.get(
"https://api.github.com/repos/nutanixdev/calm-community/contents/",
content_type="application/json",
verify=True,
status_mapping={200: True},
response_paths={"ntnx_calm_object": "$[?(@.type == 'dir')].name"},
),
is_mandatory=True,
)
RunbookTask.Exec.escript(script="print '0'")
Here both type of Task are used. It is creating confusion. Create a diff interface VariableTask
that should be used for task inside variable always.
Also restrict the scope of VariableTask
that contain tasks that can be used inside variable i.e. HTTP, escript