ansible.content_builder icon indicating copy to clipboard operation
ansible.content_builder copied to clipboard

Building VCF Rest Modules TASK [ansible.content_builder.module_openapi_cloud : Generate modules for "cloud"

Open segadson opened this issue 10 months ago • 0 comments

SUMMARY

Getting the error below on TASK [ansible.content_builder.module_openapi_cloud : Generate modules for "cloud"] An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'generate_example_cloud' is not defined fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution: name 'generate_example_cloud' is not defined", "stdout": ""}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.content_builder.module_openapi_cloud

ANSIBLE VERSION
**ansible [core 2.16.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/segadson/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/segadson/vcf_ansible_automation/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/segadson/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/segadson/vcf_ansible_automation/venv/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/home/segadson/vcf_ansible_automation/venv/bin/python)
  jinja version = 3.1.3
  libyaml = True**
CONFIGURATION
CONFIG_FILE() = None

OS / ENVIRONMENT

Windows Server 2019 WSL Ubuntu 2204

STEPS TO REPRODUCE
MANIFEST.yaml
---
collection:
  path: "example/cloud"
  namespace: example
  name: cloud
  requires_ansible: false
plugins:
  - type: "module_openapi"
    name: "example_cloud"
    content: cloud
    api_object_path: /spec/vmware-cloud-foundation.json
    resource: config # path to modules.yaml
    action: "generate_all" # generate_schemas generate_modules generate_examples
    unique_key: ""
    rm_swagger_json: ""
    module_version: "0.1.0"
    author: "Ansible Cloud Team"

EXPECTED RESULTS
ACTUAL RESULTS

(venv) segadson@vcfad:~/vcf_ansible_automation/content-builder-example$ ansible-playbook build.yaml -e manifest_file=MANIFEST.yaml
[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] **************************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item=plugins/modules)
ok: [localhost] => (item=plugins/module_utils)
ok: [localhost] => (item=plugins/module_utils/common/)
ok: [localhost] => (item=plugins/plugin_utils)
ok: [localhost] => (item=plugins/lookup)
ok: [localhost] => (item=plugins/filter)
ok: [localhost] => (item=plugins/action)
ok: [localhost] => (item=plugins/inventory)
ok: [localhost] => (item=plugins/cache)
ok: [localhost] => (item=plugins/test)
ok: [localhost] => (item=docs)
ok: [localhost] => (item=meta)
ok: [localhost] => (item=tests)

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

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': 'example/cloud/README.md'})
ok: [localhost] => (item={'source': 'galaxy.yaml.j2', 'destination': 'example/cloud/galaxy.yml'})

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

TASK [ansible.content_builder.scaffold_plugins : Scaffold the specified plugins] *************************************************************************************************************************************************************************************************************************************
included: /home/segadson/.ansible/collections/ansible_collections/ansible/content_builder/roles/scaffold_plugins/tasks/template.yml for localhost => (item={'type': 'module_openapi', 'name': 'example_cloud', 'content': 'cloud', 'api_object_path': '/spec/vmware-cloud-foundation.json', 'resource': 'config', 'action': 'generate_all', 'unique_key': '', 'rm_swagger_json': '', 'module_version': '0.1.0', 'author': 'Ansible Cloud Team'})

TASK [ansible.content_builder.scaffold_plugins : Debug message] ******************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "Scaffolding example_cloud 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 "cloud"] ************************************************************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [ansible.content_builder.module_openapi_cloud : Generate modules for "cloud"] ***********************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'generate_example_cloud' is not defined
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution: name 'generate_example_cloud' is not defined", "stdout": ""}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=11   changed=0    unreachable=0    failed=1    skipped=11   rescued=0    ignored=0   

segadson avatar Apr 12 '24 15:04 segadson