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

Adding Ansible Inventory code back here #243

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

Adding Ansible Inventory code back here #243

wants to merge 6 commits into from

Conversation

allanice001
Copy link
Contributor

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

Copy link
Contributor

@jathanism jathanism left a comment

Choose a reason for hiding this comment

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

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.

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']
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this compatible w/ NSoT v1.x please remove ['data']['devices']. The .get() call on its own is good.


# 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']:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: Ditch ['data']['devices']. 🎱

@allanice001
Copy link
Contributor Author

All paths are up to date, ['data']['devices'] removed.
Initial Ansible support documentation is available in Commit #832b5b6

Copy link
Contributor

@jathanism jathanism left a comment

Choose a reason for hiding this comment

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

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!!

@jathanism
Copy link
Contributor

bump

@jathanism
Copy link
Contributor

At this point the only thing missing are the __init__.py files in the empty directories in nsot/contrib/, nsot/contrib/ansible. Then this is SOLID. Also... Oops it's been a year. 💯

@allanice001
Copy link
Contributor Author

af952b2 has the init.py files

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Allan Swanepoel
❌ allanice001


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.

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.

None yet

3 participants