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

Two more options added to the netbox Pillar, and use salt.utils.http #48910

Merged
merged 3 commits into from
Aug 5, 2018

Conversation

mirceaulinic
Copy link
Contributor

What does this PR do?

I am applying some small (or I think so) changes to the netbox external Pillar:

  • Use salt.utils.http instead of requests to avoid external dependency.
  • Add two new options: site_details and site_prefixes.
  • versionadded tag.

@ksofa2 @ngrundler I hope you don't mind my changes, please let me know if there's anything you disagree / should be changed etc. Additionally, it would be great if you could test this out and confirm it doesn't change anything in your environment. Thanks!

@mirceaulinic mirceaulinic requested a review from a team as a code owner August 3, 2018 09:35
@ghost ghost self-requested a review August 3, 2018 09:35
@ngrundler
Copy link
Contributor

@mirceaulinic

No issues on my end, this looks great. A good learning example for me about how I can use features built into salt to remove dependencies and make things simpler!

What do you think about nesting the different NetBox API endpoints into the netbox pillar key, e.g.

"netbox": {
    "device": { <device details> },
    "site": { <site details> },
    "interfaces": { <interface details> },
    "ip-addresses": { <ip address details> }
 }

I've since made some tweaks internally since we're trying to use netbox data to drive configuration templates and I needed this data available, so I have set up queries to interfaces, addresses, connections, etc. I was planning on adding this to the module myself soon(ish), but I see no reason for that to impact this PR.

@mirceaulinic
Copy link
Contributor Author

What do you think about nesting the different NetBox API endpoints into the netbox pillar key, e.g.

That would make sense to me, yes.

@Ichabond
Copy link
Contributor

Ichabond commented Aug 3, 2018

What do you think about nesting the different NetBox API endpoints into the netbox pillar key, e.g.

I think that's a great idea, but I'd nest them in the App endpoint as well. So instead of the flatter structure you proposed, I propose:

"netbox": {
    "dcim": {
        "device": { <device details> },
        "site": { <site details> },
        "interfaces": { <interface details> }        
    },
    "ipam": {
        "ip-addresses": { <ip address details> }
    }
 }

This will make sure there's no conflicts if/when Netbox has 2 apps with identical API endpoints.

@rallytime rallytime added the ZRELEASED - Fluorine reitred label label Aug 3, 2018
@mirceaulinic
Copy link
Contributor Author

I think these proposals make sense to me, I would leave it though for another day to discuss this further. Wondering if @zachmoody has any thoughts on this?

@zachmoody
Copy link
Contributor

TIL that salt.utils.http doesn't use requests, by default anyways. That's impressive. 😄

I'd definitely nest under app though, ran into the same conundrum with earlier versions of pynetbox and in the end had to acquiesce to a two-tiered hierarchy.

Copy link
Contributor

@rallytime rallytime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@rallytime rallytime merged commit c034a86 into saltstack:develop Aug 5, 2018
@mirceaulinic mirceaulinic deleted the netbox-pillar branch August 9, 2018 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants