Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location of doc_generator.py #28

Open
john-colgrave opened this issue Dec 6, 2022 · 0 comments
Open

Location of doc_generator.py #28

john-colgrave opened this issue Dec 6, 2022 · 0 comments
Assignees

Comments

@john-colgrave
Copy link

SUMMARY

When running the content_builder for an openapi module, the file doc_generator.py is expected to be in the directory from where the playbook is run but it is not there.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

content_builder

ANSIBLE VERSION
ansible [core 2.14.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/ansible-env/lib64/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/ansible-env/bin/ansible
  python version = 3.9.14 (main, Sep 21 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)] (/root/ansible-env/bin/python3)
  jinja version = 3.1.2
  libyaml = True
CONFIGURATION

OS / ENVIRONMENT

CentOS Stream 9

STEPS TO REPRODUCE

Run the content_builder to generate a module of type openapi.

(ansible-env) [root@jc-ansible-centos91 content_builder_test]# cat build.yaml
---
- hosts: localhost
  gather_facts: yes
  roles:
    - ansible.content_builder.run
(ansible-env) [root@jc-ansible-centos91 content_builder_test]# cat MANIFEST.yaml
---
collection:
  path: /root/content_builder_test/output
  namespace: john_colgrave
  name: testos
plugins:
  - type: module_openapi
    name: testos_plugin
    module_version: 1.0.0
    rm_swagger_json: /root/content_builder_test/petstore.json
    api_object_path: /pets
    resource: testos_resource
    unique_key: ""
    author: "John Colgrave"
EXPECTED RESULTS

A module to be generated.

ACTUAL RESULTS

I got a fatal error.

(ansible-env) [root@jc-ansible-centos91 content_builder_test]# 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] ****************************************************
changed: [localhost] => (item=plugins/modules)
changed: [localhost] => (item=plugins/module_utils)
changed: [localhost] => (item=plugins/module_utils/common/)
changed: [localhost] => (item=plugins/plugin_utils)
changed: [localhost] => (item=plugins/lookup)
changed: [localhost] => (item=plugins/filter)
changed: [localhost] => (item=plugins/action)
changed: [localhost] => (item=plugins/inventory)
changed: [localhost] => (item=plugins/cache)
changed: [localhost] => (item=plugins/test)
changed: [localhost] => (item=docs)
changed: [localhost] => (item=meta)
changed: [localhost] => (item=tests)

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

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

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

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: /root/.ansible/collections/ansible_collections/ansible/content_builder/roles/scaffold_plugins/tasks/template.yml for localhost => (item={'type': 'module_openapi', 'name': 'testos_plugin', 'module_version': '1.0.0', 'rm_swagger_json': '/root/content_builder_test/petstore.json', 'api_object_path': '/pets', 'resource': 'testos_resource', 'unique_key': '', 'author': 'John Colgrave'})

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

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] *****************************
ok: [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] *******************************************
ok: [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 [ansible.content_builder.module_openapi : Get the CURRENT WORKING DIR] ********************************************************
ok: [localhost]

TASK [ansible.content_builder.module_openapi : Create temporary build directory] ***************************************************
changed: [localhost]

TASK [ansible.content_builder.module_openapi : EXECUTE the python script] **********************************************************
fatal: [localhost -> 127.0.0.1]: FAILED! => {"changed": false, "cmd": ["python3", "doc_generator.py", "/root/content_builder_test/petstore.json", "/pets", "testos_plugin", "1.0.0", "testos_resource", "john_colgrave", "testos", "", "John Colgrave", "/tmp/ansible.s8a33qnqbuild"], "delta": "0:00:00.040463", "end": "2022-12-06 00:10:21.564125", "msg": "non-zero return code", "rc": 2, "start": "2022-12-06 00:10:21.523662", "stderr": "python3: can't open file '/root/content_builder_test/doc_generator.py': [Errno 2] No such file or directory", "stderr_lines": ["python3: can't open file '/root/content_builder_test/doc_generator.py': [Errno 2] No such file or directory"], "stdout": "", "stdout_lines": []}

NO MORE HOSTS LEFT *****************************************************************************************************************

PLAY RECAP *************************************************************************************************************************
localhost                  : ok=14   changed=5    unreachable=0    failed=1    skipped=7    rescued=0    ignored=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants