Adding Ansible Inventory code back here#243
Adding Ansible Inventory code back here#243allanice001 wants to merge 6 commits intodropbox:masterfrom allanice001:master
Conversation
jathanism
left a comment
There was a problem hiding this comment.
Can you please make this nsot.contrib.ansible.inventory.nsot? And please remember to add the __init__.py files in the empty directories. 😬
I think we should go ahead and add a section to the docs for Ansible support as well if you're interested. If not, I can do that part.
contrib/inventory/nsot.py
Outdated
| Depending on number of devices in NSoT, could be rather slow since this | ||
| has to request every device resource to filter through | ||
| ''' | ||
| device = [i for i in self.client.devices.get()['data']['devices'] |
There was a problem hiding this comment.
To make this compatible w/ NSoT v1.x please remove ['data']['devices']. The .get() call on its own is good.
contrib/inventory/nsot.py
Outdated
|
|
||
| # Would do a list comprehension here, but would like to save code/time | ||
| # and also acquire attributes in this step | ||
| for host in devices['data']['devices']: |
There was a problem hiding this comment.
Same here: Ditch ['data']['devices']. 🎱
|
All paths are up to date, |
jathanism
left a comment
There was a problem hiding this comment.
So I thought we agreed on making the contrib directory an actual package, which means this whole contrib tree needs to be moved into the nsot directory.
Then each directory under it needs to have an __init__.py file so that the paths can be correctly imported.
Ya dig?
Also, sorry about the delay in response. I just got back from holiday today!!
|
bump |
|
At this point the only thing missing are the |
|
af952b2 has the init.py files |
|
Allan Swanepoel seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Will start working on extending the dynamic inventory code in the next couple of days, but thought of having it here for better local visibility.
Also, this would most likely become a sub module / standalone python package for ease of deployment - Could we create a dropbox/nsot-inventory Repo to house it in?
It will also allow for improved testing of this module