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

Support Jinja2 templating of secret parameters #1058

Merged
merged 3 commits into from
Nov 9, 2021

Conversation

glennmatthews
Copy link
Contributor

Toward: #541

This should be the last incremental PR atop #868.

  • Add support for Jinja2 templating of secrets provider parameters, allowing you to do things like specify a whole family of device passwords stored as text files on disk as "/opt/nautobot/device_passwords/{{ obj.site.slug }}/{{ obj.name }}.txt" or a whole family of Git repository secrets stored in environment variables as "GIT_TOKEN_{{ obj.slug | replace('-', '_') | upper }}".
    • This does change the secrets API a bit, so existing (beta) secret provider implementations have to be updated to account for this change.
  • Restructure and refine the Secrets documentation, particularly accounting for the fact that per-model documentation files aren't supposed to cross-link to other documentation files due to limitations of the online-help renderer.
  • Improve test coverage somewhat.

@glennmatthews
Copy link
Contributor Author

glennmatthews commented Nov 8, 2021

TODO: add "Secrets Providers" to the installed-plugins detail view page.

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.

Another quality hit from Glenn. I have some minor comments/suggestions but nothing show stopping.

nautobot/extras/tests/test_models.py Show resolved Hide resolved
nautobot/docs/core-functionality/secrets.md Outdated Show resolved Hide resolved
mkdocs.yml Show resolved Hide resolved
@glennmatthews glennmatthews merged commit 58c117c into gfm-secrets Nov 9, 2021
@glennmatthews glennmatthews deleted the gfm-secrets-templates branch November 9, 2021 17:43
glennmatthews added a commit that referenced this pull request Nov 15, 2021
… Groups (#868)

* Initial model, UI, and REST API for Secrets

* Secrets providers API, initial TextFile and EnvironmentVariable provider implementations (#887)

* Add Secret.value property, add EnvironmentVariable provider, add dummy-plugin Constant provider, add tests

* Add TextFileSecretProvider

* Add docs

* Improve display of secret providers in the UI

* Refactor SecretsProvider registration to use the Nautobot registry instead of python entry_points

* Refactor slightly

* Add ability for secrets providers to define an HTML form for parameter inputs

* Fix default value for JSONField and add error handling in JS

* Add username_secret and token_secret support to GitRepository

* Docs updates

* Review feedback - add description field, etc.

* Revise secrets docs; add SecretError exceptions instead of returning None on various failures

* One of these days I'll remember to run flake8 before pushing

* Review comments

* SecretsGroup feature (#1042)

* WIP

* More WIP

* WIP remove SecretType model

* Such WIP. Wow

* WIP: working secretsgroup-edit UI

* More WIP

* Change Category/Meaning to Access Type/Secret Type

* Add SecretsGroup key to Device model; get tests passing

* Add test coverage for REST API and filters

* Add SecretsGroup view tests

* Linting fixes

* Docs updates

* Cleanup leftover SecretType cruft

* Update nautobot/docs/user-guides/git-data-source.md

Co-authored-by: Jathan McCollum <jathan@gmail.com>

* Fix egregious issues

Co-authored-by: Jathan McCollum <jathan@gmail.com>

* Support Jinja2 templating of secret parameters (#1058)

* Support Jinja2 templating of secret parameters

* Add secrets providers to plugin detail view

* Doc updates

* Include SecretsGroupAssociation in GraphQL

* Move 'Secrets' to a top-level menu

* Don't try to sort `SecretsProvider` class objects in plugin config features registry (#1065)

* Fix TypeError when trying to sort `SecretsProvider` class objects
* Don't sort `secrets_providers` when added to features.

* Add release-note content for Secrets

* Update nautobot/extras/views.py

Co-authored-by: John Anderson <lampwins@gmail.com>

* Change FK to SecretsGroup behavior to SET_NULL

* Use render_jinja2() in rendered_parameters()

Co-authored-by: Jathan McCollum <jathan@gmail.com>
Co-authored-by: John Anderson <lampwins@gmail.com>
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

2 participants