-
Notifications
You must be signed in to change notification settings - Fork 740
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
ntc-templates the package #6
Conversation
Totally on board with this and de-coupling the templates from the ntc-ansible directory was done for this reason (trigger team asked). We now need a mechanism in the ansible module to find the templates (assuming pip / setup.py install) as first option then use the existing way as a second option...like a auto loader / finder function for templates. I can work on this and pretty sure I've done it already. And yes love the fact they can now be used in Python as you show below. Getting on a flight now, but looks like this upcoming week will be a fun one for testing. Thanks man. Great stuff.
|
By the way the setup code would look a lot better if we would move the current "templates" directory into the ntc_templates directory. But this would break current stuff and can perhaps be done later. Also forgot to mention, the above Python code won't work if your current directory is the repo, you will have to move outside of that directory in order to test. |
I'm missing a way to distribute the templates in a way which doesn't include github (which is currently blocked from my environment).
I had a thought of optionally treating ntc-templates as a Python package. This can be done without impacting the project in any other way. The setup.py file gets a bit strange though.
Another reason to have this is to make it easier to use the ntc-templates outside of Ansible. In the future the Ansible module could be changed to use this package instead.
To test:
An example of how the package can be used:
Perhaps the function of the names could be changed.
Probably we'll just raise an exception if someone tries to use a template which hasn't been created. Perhaps also print the version of ntc_templates so that it's easy to point people to a later version if a template already exists.
If this is supported more files will need to be added to the .gitignore file and perhaps the README.md should be changed to .rst for pypi support.