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

Issue #1300 - nb_inventory injecting a variable as api_endpoint #1301

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from

Conversation

bookshark13
Copy link

Fixes issue-#1300
allows api_endpoint to be a variable and string

Related Issue

#1300

New Behavior

calls the templar.template module to transform the api_endpoint if referenced as a variable e.g: "{{ fake_var }}"

Contrast to Current Behavior

fake_var: "https://netbox.test.domain.com"
Current behavior for a inventory file is referencing api_endpoint: "{{ fake_var }}"
for the above example you would receive an error to the affect of

[WARNING]: * Failed to parse <location of your netbox plugin> with auto plugin: unknown url type: "{{ fake_var }}/api/status"

this solves that issue and the result is no error and we can see
Fetching: https://netbox.test.domain.com/api/status

Discussion: Benefits and Drawbacks

  • This could be beneficial to the plugin as a whole, not everyone has one netbox environment. As well nor do they share domain names. This change allows for dynamically calling the api_endpoint. While also not changing anyones current setup
  • I believe there are no real drawbacks for this change. It does not take away functionality. Truly it only increases the way you can call the api_endpoint
  • Yes it is backwards-compatible

Changes to the Documentation

N/A

Proposed Release Note Entry

netbox.nb_inventory: api_endpoint option can now take variable calls E.G: api_endpoint: "{{ netbox_url }}"

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

@sc68cal
Copy link
Contributor

sc68cal commented Dec 25, 2024

The netbox inventory plugin already supports the environment variable NETBOX_API as documented here.

Can you shed some light on why this change is required when we already have this environment variable?

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

Successfully merging this pull request may close these issues.

2 participants