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

'dict object' has no attribute 'resource' #81

Open
displague opened this issue Mar 12, 2024 · 0 comments
Open

'dict object' has no attribute 'resource' #81

displague opened this issue Mar 12, 2024 · 0 comments

Comments

@displague
Copy link

displague commented Mar 12, 2024

SUMMARY

I'm attempting to create an example project with a simple Dockerfile and Makefile to make it easy to see ansible.content_builder in action against a given API spec.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION
# MANIFEST.yaml
---
collection:
  path: "example/cloud"
  namespace: example
  name: cloud
plugins:
  - type: "module_openapi"
    name: "example_cloud"
    content: cloud
    api_object_path: /spec/oas.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"
# build.yaml
---
- hosts: localhost
  gather_facts: yes
  roles:
    - ansible.content_builder.run
# requirements.yaml
collections:
# - name: ansible.content_builder
- name: git+https://github.com/ansible-community/ansible.content_builder.git
  type: git
  version: main
OS / ENVIRONMENT
STEPS TO REPRODUCE

displague/content-builder-example#1

git clone https://github.com/displague/content-builder-example
cd content-builder-example
make spec_url=https://raw.githubusercontent.com/OpenAPITools/openapi-petstore/master/src/main/resources/openapi.yaml
EXPECTED RESULTS

A clean build with a generated collection in example/, or a clear error message about what was wrong.

ACTUAL RESULTS
The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'resource'. 'dict object' has no attribute 'resource'

The error appears to be in '/root/.ansible/collections/ansible_collections/ansible/content_builder/roles/module_openapi_cloud/tasks/main.yaml': line 10, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Generate modules for "{{ collection['name'] }}"
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"
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

1 participant