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

Runbooks HTTP task variable failing

Open pipoe2h opened this issue 3 years ago • 0 comments

Creating a Runbook variable of HTTP type doesn't work when using RunbookVariable and RunbookTask. The error is:

[2021-05-04 12:55:45] [ERROR] [calm.dsl.builtins.models.runbook:134] http_task_get_on_endpoint() takes 0 positional arguments but 1 was given

Example code:

from calm.dsl.runbooks import runbook, runbook_json
from calm.dsl.runbooks import RunbookTask as Task, RunbookVariable as Variable
@runbook
def DslCommunityRunbook():
    ntnx_calm_object = Variable.WithOptions.FromTask(
        Task.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,
    )

pipoe2h avatar May 04 '21 16:05 pipoe2h