nutanix / calm-dsl

Keep Calm and DSL On!
https://nutanix.github.io/calm-dsl/
Apache License 2.0
32 stars 51 forks source link

Runbooks HTTP task variable failing #171

Open pipoe2h opened 3 years ago

pipoe2h commented 3 years ago

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,
    )