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

Plugin Module errors after if it runs against an existing firewall policy #246

Open
gneville-ot opened this issue Sep 1, 2023 · 0 comments

Comments

@gneville-ot
Copy link
Contributor

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.5.0

Ansible:

2.12.2

Nautobot:

1.5.0

Collection:

4.5.0

SUMMARY

When running the plugin module against an existing firewall policy that already exists the task will error.

STEPS TO REPRODUCE

Create a firewall policy and then have the plugin module run against the same policy.

Note: due to #245 if the firewall policy is created by the module first time it will error as explained in the linked PR. If you run it again you'll get the error reported in this issue.

- name: "SETUP FIREWALL POLICY"
  networktocode.nautobot.plugin:
    url: "{{ nb_url }}"
    token: "{{ nb_token }}"
    validate_certs: "{{ nb_validate_certs }}"
    api_version: "{{ nb_api_version }}"
    plugin: "firewall"
    endpoint: "policy"
    identifiers:
      name: "MY_POLICY"
    attrs:
      description: "My policy"
      status: "active"
      assigned_devices:
       - device: 1f51f71c-35f3-49fe-8d38-18be7bf5964b
         weight: 100
    state: "present"
EXPECTED RESULTS

The task results in no changes and is a success.

ACTUAL RESULTS

The task returns an error

      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/response.py", line 344, in serialize
        current_val = [v.id if isinstance(v, Record) else v for v in current_val]
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/response.py", line 344, in <listcomp>
        current_val = [v.id if isinstance(v, Record) else v for v in current_val]
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/response.py", line 190, in __getattr__
        raise AttributeError('object has no attribute "{}"'.format(k))
    AttributeError: object has no attribute "id"
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