redhat-openstack / infrared

Plugin based framework that aims to provide an easy-to-use CLI for Ansible based projects
https://infrared.readthedocs.io/en/latest/index.html
Apache License 2.0
99 stars 97 forks source link

Values are not being resolved according to ComplexType when using 'ansible_variable' #349

Closed vkhitrin closed 5 years ago

vkhitrin commented 5 years ago

Description

The following commit e20ad3f91e621b12dabcd8291aa674e92811f329 introduced an option to supply custom Ansible variable for plugins instead of using Infrared's generated variables.

When using custom Ansible variables, they do not get resolved according to ComplexType's type.

Using the following plugin-spec:

---
config:
    plugin_type: other
subparsers:
    foo-plugin:
        description: foo
        include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"]
        groups:
            - title: Foo
              options:
                  foo:
                      type: FileValue
                      help: 'File to be fetched from URL'
                      required: yes
                      ansible_variable: my_var

Current behaviour

Executing infrared command infrared foo-plugin --foo tox.ini:

my_var: tox.ini
other: {}
...output omittied...

This thus not resolve the file's absolute path as per the documentation.

Expected behaviour

Executing infrared command infrared foo-plugin --foo tox.ini:

my_var: /Users/vkhitrin/Projects/Development/infrared/tox.ini
other: {}
...output omittied...
vkhitrin commented 5 years ago

@avishaymahluf As we discussed this a month ago, I found the issue and proposed a patch in gerrit.