Skip to content

Fully support the time unit conversion and have correct types for our values #285

@schurzi

Description

@schurzi

While investigating #278 we discovered, that the API returns the timeout as an integer and our module declares it as a string. This is not visible in the diff but the type is used in comparing the values from the dict.

API returns:

{
...
    "timeout": 60,
...
}

Module contains:

{
...
    "timeout": "60",
...
}

The apparent simple fix would be to also declare timeout as int in our Ansible module. But that will be a breaking change and it also removes a "feature" of the director API. Currently we can define time intervalls for example as "5m" leading to 300 being saved. But this needs timeout to be specified as str, thus breaking the diff.

Ansible has functions to convert time intervalls to a base unit (https://github.com/ansible-collections/community.general/blob/main/plugins/filter/to_seconds.yml), so we could try to include these functions to get a clean diff. But that would need to be encoded in special cases.

Originally posted by @schurzi in #278 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions