ansible-community / ansible.content_builder

A collection to scaffold Ansible plugins.
GNU General Public License v3.0
31 stars 27 forks source link

Building vra_rest module fails #80

Open zakhooi opened 8 months ago

zakhooi commented 8 months ago
SUMMARY

Building module fails due to undefined variable.

ISSUE TYPE
COMPONENT NAME

ansible.content_builder

ANSIBLE VERSION
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/Users/lefem01/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/9.2.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/lefem01/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/usr/local/Cellar/ansible/9.2.0/libexec/bin/python)
  jinja version = 3.0.3
  libyaml = True
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

MACOS 14.3

STEPS TO REPRODUCE

The problem occurs when building the ansible playbook module using the MANIFEST.yaml and build.yaml files

ansible-playbook build.yaml -e manifest_file=MANIFEST.yaml
EXPECTED RESULTS
ACTUAL RESULTS
% ansible-playbook build.yaml -e manifest_file=MANIFEST.yaml

[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [localhost] *****************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [localhost]

TASK [ansible.content_builder.run : Validate task input against defined schema] **************************************************************
ok: [localhost]

TASK [ansible.content_builder.run : Load settings from manifest file] ************************************************************************
ok: [localhost]

TASK [Start scaffolding] *********************************************************************************************************************

TASK [ansible.content_builder.init : Create the collection directory structure] **************************************************************
skipping: [localhost] => (item=plugins/modules) 
skipping: [localhost] => (item=plugins/module_utils) 
skipping: [localhost] => (item=plugins/module_utils/common/) 
skipping: [localhost] => (item=plugins/plugin_utils) 
skipping: [localhost] => (item=plugins/lookup) 
skipping: [localhost] => (item=plugins/filter) 
skipping: [localhost] => (item=plugins/action) 
skipping: [localhost] => (item=plugins/inventory) 
skipping: [localhost] => (item=plugins/cache) 
skipping: [localhost] => (item=plugins/test) 
skipping: [localhost] => (item=docs) 
skipping: [localhost] => (item=meta) 
skipping: [localhost] => (item=tests) 
skipping: [localhost]

TASK [ansible.content_builder.init : Touch the __init__.py in each directory] ****************************************************************
skipping: [localhost] => (item=plugins/modules) 
skipping: [localhost] => (item=plugins/module_utils) 
skipping: [localhost] => (item=plugins/module_utils/common/) 
skipping: [localhost] => (item=plugins/plugin_utils) 
skipping: [localhost] => (item=plugins/lookup) 
skipping: [localhost] => (item=plugins/filter) 
skipping: [localhost] => (item=plugins/action) 
skipping: [localhost] => (item=plugins/inventory) 
skipping: [localhost] => (item=plugins/cache) 
skipping: [localhost] => (item=plugins/test) 
skipping: [localhost] => (item=docs) 
skipping: [localhost] => (item=meta) 
skipping: [localhost] => (item=tests) 
skipping: [localhost]

TASK [ansible.content_builder.init : Add license file to collection (default is gpl-3.0)] ****************************************************
ok: [localhost]

TASK [ansible.content_builder.init : Add readme to collection] *******************************************************************************
ok: [localhost] => (item={'source': 'README.md.j2', 'destination': './/README.md'})
ok: [localhost] => (item={'source': 'galaxy.yaml.j2', 'destination': './/galaxy.yml'})

TASK [ansible.content_builder.init : Create the collection directory structure] **************************************************************
skipping: [localhost] => (item=plugins/modules) 
skipping: [localhost] => (item=plugins/action) 
skipping: [localhost] => (item=tests) 
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Scaffold the specified plugins] *************************************************************
included: /Users/lefem01/.ansible/collections/ansible_collections/ansible/content_builder/roles/scaffold_plugins/tasks/template.yml for localhost => (item={'type': 'module_openapi', 'name': 'vra_rest', 'content': 'cloud', 'api_object_path': 'api_specifications/2021-07-15', 'resource': 'config', 'action': 'generate_all', 'unique_key': '', 'rm_swagger_json': '/iaas.json', 'module_version': '0.1.0', 'author': 'Thomas van den Nieuwenhoff'})

TASK [ansible.content_builder.scaffold_plugins : Debug message] ******************************************************************************
ok: [localhost] => {
    "msg": "Scaffolding vra_rest of type module_openapi"
}

TASK [ansible.content_builder.scaffold_plugins : Set facts] **********************************************************************************
ok: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Set path to main plugin file for generic plugins] *******************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Set path to main plugin file for specialized plugins] ***************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Load docstring (if specified)] **************************************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Load examples from example file (if specified)] *********************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Check to see if the plugin file exists] *****************************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Check if documentation string can be found] *************************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Extract documentation from plugin (for existing plugin)] ************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Fail if no docstring could be found] ********************************************************
skipping: [localhost]

TASK [ansible.content_builder.scaffold_plugins : Extract examples from plugin (for existing plugin)] *****************************************
skipping: [localhost]

TASK [Start scaffolding specialized plugin] **************************************************************************************************

TASK [Generate security content] *************************************************************************************************************
skipping: [localhost]

TASK [Generate cloud content] ****************************************************************************************************************

TASK [ansible.content_builder.module_openapi_cloud : Generate schema for "vra_rest"] *********************************************************
skipping: [localhost]

TASK [ansible.content_builder.module_openapi_cloud : Generate modules for "vra_rest"] ********************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'requires_ansible'. 'dict object' has no attribute 'requires_ansible'\n\nThe error appears to be in '/Users/user01/.ansible/collections/ansible_collections/ansible/content_builder/roles/module_openapi_cloud/tasks/main.yaml': line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Generate modules for \"{{ collection['name'] }}\"\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

PLAY RECAP ***********************************************************************************************************************************
localhost                  : ok=8    changed=0    unreachable=0    failed=1    skipped=14   rescued=0    ignored=0 
mariolenz commented 8 months ago

Would it be possible for you to show us your build.yaml and MANIFEST.yaml?