Skip to content

User defined query missing napalm_driver causes add_ansible_platform to fail. #663

@qduk

Description

@qduk
ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

3.0.0

Ansible:

2.18.11

Nautobot:

2.0.0

Collection:

networktocode.nautobot v6.0.0

SUMMARY

If a user defines a custom graphql query for devices -> platform but does not include "napalm_driver" as a value, the add_ansible_platform method fails to add the napalm driver as it checks for the existence of the napalm_driver key in the platform dictionary.

STEPS TO REPRODUCE

In your inventory file, create a graphql option like so:


query:
  devices:
    filters:
      has_primary_ip: true
    platform:
      name:
    primary_ip4:
      host:

Then, run your inventory sync. You'll notice that the ansible_network_os variable does not get assigned to the hosts.

EXPECTED RESULTS

I'd expect for the code to merge the needed napalm_driver into the query as it is part of the base query

ACTUAL RESULTS

My definition of platform overrides the base_query entirely resulting in the loss of the napalm_driver key

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions