From 562f3f3ef4bd110c9e903898c3c9e9b82b850146 Mon Sep 17 00:00:00 2001 From: bakebot Date: Wed, 13 Sep 2023 10:26:54 +0000 Subject: [PATCH 1/9] Cookie initialy baked by NetworkToCode Cookie Drift Manager Tool Template: ``` { "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "dir": "nautobot-app", "ref": "develop", "path": null } ``` Cookie: ``` { "remote": "https://github.com/nautobot/nautobot-plugin-golden-config.git", "path": "/opt/ntc/drift-manager/outputs/nautobot-plugin-golden-config", "repository_path": "/opt/ntc/drift-manager/outputs/nautobot-plugin-golden-config", "dir": "", "branch_prefix": "drift-manager", "context": { "codeowner_github_usernames": "@itdependsnetworks @jeffkala @nkallergis", "full_name": "Network to Code, LLC", "email": "opensource@networktocode.com", "github_org": "nautobot", "plugin_name": "nautobot_golden_config", "verbose_name": "Golden Config", "plugin_slug": "nautobot-golden-config", "project_slug": "nautobot-plugin-golden-config", "repo_url": "https://github.com/nautobot/nautobot-plugin-golden-config", "base_url": "golden-config", "min_nautobot_version": "1.4.0", "max_nautobot_version": "1.9999", "nautobot_version": "latest", "camel_name": "NautobotGoldenConfig", "project_short_description": "A plugin for configuration on nautobot", "version": "1.0.0", "model_class_name": "None", "open_source_license": "Apache-2.0", "docs_base_url": "https://docs.nautobot.com", "docs_app_url": "https://docs.nautobot.com/projects/golden-config/en/latest", "_template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "_output_dir": "/opt/ntc/drift-manager/outputs", "_repo_dir": "/opt/ntc/drift-manager/outputs/.cookiecutters/cookiecutter-nautobot-app/nautobot-app" }, "base_branch": "next-2.0", "remote_name": "origin", "pull_request_strategy": "PullRequestStrategy.CREATE", "post_actions": [] } ``` CLI Arguments: ``` { "cookie_dir": "", "input": false, "json_filename": "./setup-cookie-golden-config.json", "output_dir": "./outputs", "push": true, "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "template_dir": "nautobot-app", "template_ref": "develop", "pull_request": null, "post_action": [], "disable_post_actions": false } ``` --- .bandit.yml | 7 +- .cookiecutter.json | 33 ++ .dockerignore | 27 ++ .flake8 | 12 +- .github/CODEOWNERS | 2 +- .github/ISSUE_TEMPLATE/bug_report.md | 16 +- .github/ISSUE_TEMPLATE/feature_request.md | 4 +- .../pull_request_template.md | 10 + .github/workflows/ci.yml | 49 ++- .github/workflows/rebake.yaml | 34 ++ .github/workflows/upstream_testing.yml | 6 +- .gitignore | 26 +- .readthedocs.yaml | 4 +- .yamllint.yml | 5 +- LICENSE | 2 +- README.md | 73 ++-- development/Dockerfile | 37 +- development/development.env | 13 - development/docker-compose.base.yml | 4 +- development/docker-compose.dev.yml | 21 +- development/docker-compose.mysql.yml | 8 +- development/docker-compose.postgres.yml | 4 +- development/nautobot_config.py | 171 +++----- docs/admin/compatibility_matrix.md | 18 +- docs/admin/install.md | 81 ++++ docs/admin/release_notes/version_1.0.md | 74 ++-- docs/admin/uninstall.md | 18 + docs/admin/upgrade.md | 10 + docs/assets/extra.css | 76 +++- docs/assets/overrides/partials/copyright.html | 2 + docs/dev/arch_decision.md | 7 + docs/dev/code_reference/api.md | 1 - docs/dev/code_reference/index.md | 3 + docs/dev/code_reference/package.md | 1 + docs/dev/contributing.md | 24 + docs/dev/dev_environment.md | 38 +- docs/dev/extending.md | 6 + docs/images/icon-nautobot-golden-config.png | Bin 0 -> 74601 bytes docs/requirements.txt | 6 +- docs/user/app_getting_started.md | 228 +--------- docs/user/app_overview.md | 38 +- docs/user/app_use_cases.md | 207 +-------- docs/user/external_interactions.md | 17 + docs/user/faq.md | 1 + invoke.example.yml | 2 +- invoke.mysql.yml | 2 +- mkdocs.yml | 62 +-- nautobot_golden_config/__init__.py | 55 +-- nautobot_golden_config/tests/test_api.py | 409 +----------------- nautobot_golden_config/tests/test_basic.py | 17 +- pyproject.toml | 71 ++- tasks.py | 347 ++++++++++++--- 52 files changed, 1009 insertions(+), 1380 deletions(-) create mode 100644 .cookiecutter.json create mode 100644 .dockerignore create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md create mode 100644 .github/workflows/rebake.yaml create mode 100644 docs/admin/install.md create mode 100644 docs/admin/uninstall.md create mode 100644 docs/admin/upgrade.md create mode 100644 docs/dev/arch_decision.md create mode 100644 docs/dev/code_reference/package.md create mode 100644 docs/dev/contributing.md create mode 100644 docs/dev/extending.md create mode 100644 docs/images/icon-nautobot-golden-config.png create mode 100644 docs/user/external_interactions.md create mode 100644 docs/user/faq.md diff --git a/.bandit.yml b/.bandit.yml index 16ab010a..56f7a83b 100644 --- a/.bandit.yml +++ b/.bandit.yml @@ -1,7 +1,6 @@ --- +skips: [] # No need to check for security issues in the test scripts! exclude_dirs: - - "./nautobot_golden_config/tests/" - -skips: - - "B404" + - "./tests/" + - "./.venv/" diff --git a/.cookiecutter.json b/.cookiecutter.json new file mode 100644 index 00000000..ea65bfeb --- /dev/null +++ b/.cookiecutter.json @@ -0,0 +1,33 @@ +{ + "cookiecutter": { + "codeowner_github_usernames": "@itdependsnetworks @jeffkala @nkallergis", + "full_name": "Network to Code, LLC", + "email": "opensource@networktocode.com", + "github_org": "nautobot", + "plugin_name": "nautobot_golden_config", + "verbose_name": "Golden Config", + "plugin_slug": "nautobot-golden-config", + "project_slug": "nautobot-plugin-golden-config", + "repo_url": "https://github.com/nautobot/nautobot-plugin-golden-config", + "base_url": "golden-config", + "min_nautobot_version": "1.4.0", + "max_nautobot_version": "1.9999", + "nautobot_version": "latest", + "camel_name": "NautobotGoldenConfig", + "project_short_description": "A plugin for configuration on nautobot", + "version": "1.0.0", + "model_class_name": "None", + "open_source_license": "Apache-2.0", + "docs_base_url": "https://docs.nautobot.com", + "docs_app_url": "https://docs.nautobot.com/projects/golden-config/en/latest", + "_drift_manager": { + "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", + "template_dir": "nautobot-app", + "template_ref": "develop", + "cookie_dir": "", + "branch_prefix": "drift-manager", + "pull_request_strategy": "create", + "post_actions": [] + } + } +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..2270f496 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +# Docker related +development/Dockerfile +development/docker-compose*.yml +development/*.env +*.env +environments/ + +# Python +**/*.pyc +**/*.pyo +**/__pycache__/ +**/.pytest_cache/ +**/.venv/ + + +# Other +docs/_build +FAQ.md +.git/ +.gitignore +.github +tasks.py +LICENSE +**/*.log +**/.vscode/ +invoke*.yml +tasks.py diff --git a/.flake8 b/.flake8 index aaa63b60..c9f5e84d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,10 @@ [flake8] -# E501: Line length is enforced by Black, so flake8 doesn't need to check it -# W503: Black disagrees with this rule, as does PEP 8; Black wins -ignore = E501, W503, F811, F401, F405, E203 +ignore = + E501, # Line length is enforced by Black, so flake8 doesn't need to check it + W503 # Black disagrees with this rule, as does PEP 8; Black wins +exclude = + migrations, + __pycache__, + manage.py, + settings.py, + .venv diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 30cca39a..d1982711 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ -# Default owners for all files in this repository +# Default owner(s) of all files in this repository * @itdependsnetworks @jeffkala @nkallergis diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8f26fcbf..cbb194ae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -5,9 +5,16 @@ about: Report a reproducible bug in the current release of nautobot-golden-confi ### Environment * Python version: -* Nautobot version: +* Nautobot version: * nautobot-golden-config version: + +### Expected Behavior + + + +### Observed Behavior + -### Expected Behavior - - - -### Observed Behavior diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 924a52ad..a8d54617 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,11 +1,11 @@ --- name: ✨ Feature Request about: Propose a new feature or enhancement + --- ### Environment -* Python version: -* Nautobot version: +* Nautobot version: * nautobot-golden-config version:

- +
- +
- An App for Nautobot. + An App for Nautobot.

## Overview -The Golden Config plugin is a Nautobot plugin that provides a NetDevOps approach to golden configuration and configuration compliance. - -### Key Use Cases - -This plugin enable five (5) key use cases. +> Developer Note: Add a long (2-3 paragraphs) description of what the App does, what problems it solves, what functionality it adds to Nautobot, what external systems it works with etc. -1. **Configuration Backups** - Is a Nornir process to connect to devices, optionally parse out lines/secrets, backup the configuration, and save to a Git repository. -2. **Intended Configuration** - Is a Nornir process to generate configuration based on a Git repo of Jinja files to combine with a GraphQL generated data and a Git repo to store the intended configuration. -3. **Source of Truth Aggregation** - Is a GraphQL query per device that creates a data structure used in the generation of configuration. -4. **Configuration Compliance** - Is a process to run comparison of the actual (via backups) and intended (via Jinja file creation) CLI configurations upon saving the actual and intended configuration. This is started by either a Nornir process for cli-like configurations or calling the API for json-like configurations -5. **Configuration Postprocessing** - (beta) This process renders a valid configuration artifact from an intended configuration, that can be pushed to devices. The current implementation renders this configuration; however, **it doesn't push it** to the target device. +### Screenshots -> Notice: The operators of their own Nautobot instance are welcome to use any combination of these features. Though the appearance may seem like they are tightly coupled, this isn't actually the case. For example, one can obtain backup configurations from their current RANCID/Oxidized process and simply provide a Git Repo of the location of the backup configurations, and the compliance process would work the same way. Also, another user may only want to generate configurations, but not want to use other features, which is perfectly fine to do so. +> Developer Note: Add any representative screenshots of the App in action. These images should also be added to the `docs/user/app_use_cases.md` section. -## Screenshots +> Developer Note: Place the files in the `docs/images/` folder and link them using only full URLs from GitHub, for example: `![Overview](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/plugin-overview.png)`. This absolute static linking is required to ensure the README renders properly in GitHub, the docs site, and any other external sites like PyPI. -There are many features and capabilities the plugin provides into the Nautobot ecosystem. The following screenshots are intended to provide a quick visual overview of some of these features. +More screenshots can be found in the [Using the App](https://docs.nautobot.com/projects/golden-config/en/latest/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality: -The golden configuration is driven by jobs that run a series of tasks and the result is captured in this overview. - -![Overview](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/ss_golden-overview.png) - -The compliance report provides a high-level overview on the compliance of your network. -![Compliance Report](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/ss_compliance-report.png) - -The compliance overview will provide a per device and feature overview on the compliance of your network devices. -![Compliance Overview](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/ss_compliance-overview.png) - -Drilling into a specific device and feature, you can get an immediate detailed understanding of your device. -![Compliance Device](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/ss_compliance-device.png) - -![Compliance Rule](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/ss_compliance-rule.png) +![](https://raw.githubusercontent.com/nautobot/nautobot-plugin-golden-config/develop/docs/images/placeholder.png) ## Try it out! +> Developer Note: Only keep this section if appropriate. Update link to correct sandbox. + This App is installed in the Nautobot Community Sandbox found over at [demo.nautobot.com](https://demo.nautobot.com/)! > For a full list of all the available always-on sandbox environments, head over to the main page on [networktocode.com](https://www.networktocode.com/nautobot/sandbox-environments/). ## Documentation -Full web-based HTML documentation for this app can be found over on the [Nautobot Docs](https://docs.nautobot.com/projects/golden-config/en/latest/) website: +Full documentation for this App can be found over on the [Nautobot Docs](https://docs.nautobot.com) website: -- [User Guide](https://docs.nautobot.com/projects/golden-config/en/latest/user/app_overview/) - Overview, Using the App, Getting Started, Navigating compliance (cli, json, custom), backup, app usage, intended state creation. -- [Administrator Guide](https://docs.nautobot.com/projects/golden-config/en/latest/admin/admin_install/) - How to Install, Configure, Upgrade, or Uninstall the App. -- [Developer Guide](https://docs.nautobot.com/projects/golden-config/en/latest/dev/dev_contributing/) - Extending the App, Code Reference, Contribution Guide. -- [Release Notes / Changelog](https://docs.nautobot.com/projects/golden-config/en/latest/admin/release_notes/) -- [Frequently Asked Questions](https://docs.nautobot.com/projects/golden-config/en/latest/user/app_faq/) +- [User Guide](https://docs.nautobot.com/projects/golden-config/en/latest/user/app_overview/) - Overview, Using the App, Getting Started. +- [Administrator Guide](https://docs.nautobot.com/projects/golden-config/en/latest/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App. +- [Developer Guide](https://docs.nautobot.com/projects/golden-config/en/latest/dev/contributing/) - Extending the App, Code Reference, Contribution Guide. +- [Release Notes / Changelog](https://docs.nautobot.com/projects/golden-config/en/latest/admin/release_notes/). +- [Frequently Asked Questions](https://docs.nautobot.com/projects/golden-config/en/latest/user/faq/). -### Contributing to the Docs +### Contributing to the Documentation -You can find all the Markdown source for the App documentation under the [docs](https://github.com/nautobot/nautobot-plugin-golden-config/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient - clone the repository and edit away. +You can find all the Markdown source for the App documentation under the [`docs`](https://github.com/nautobot/nautobot-plugin-golden-config/tree/develop/docs) folder in this repository. For simple edits, a Markdown capable editor is sufficient: clone the repository and edit away. -If you need to view the fully generated documentation site, you can build it with [mkdocs](https://www.mkdocs.org/). A container hosting the docs will be started using the invoke commands (details in the [Development Environment Guide](https://docs.nautobot.com/projects/golden-config/en/latest/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). As your changes are saved, the live docs will be automatically reloaded. +If you need to view the fully-generated documentation site, you can build it with [MkDocs](https://www.mkdocs.org/). A container hosting the documentation can be started using the `invoke` commands (details in the [Development Environment Guide](https://docs.nautobot.com/projects/golden-config/en/latest/dev/dev_environment/#docker-development-environment)) on [http://localhost:8001](http://localhost:8001). Using this container, as your changes to the documentation are saved, they will be automatically rebuilt and any pages currently being viewed will be reloaded in your browser. Any PRs with fixes or improvements are very welcome! ## Questions -For any questions or comments, please check the [FAQ](https://docs.nautobot.com/projects/golden-config/en/latest/user/app_faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. +For any questions or comments, please check the [FAQ](https://docs.nautobot.com/projects/golden-config/en/latest/user/faq/) first. Feel free to also swing by the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`), sign up [here](http://slack.networktocode.com/) if you don't have an account. diff --git a/development/Dockerfile b/development/Dockerfile index 7b596e27..34ba9b20 100644 --- a/development/Dockerfile +++ b/development/Dockerfile @@ -1,16 +1,16 @@ # ------------------------------------------------------------------------------------- -# Nautobot Plugin Development Dockerfile Template -# Version: 0.0.1 +# Nautobot App Developement Dockerfile Template +# Version: 1.1.0 # -# Plugins that need to add additional steps or packages can do in the section below. +# Apps that need to add additional steps or packages can do in the section below. # ------------------------------------------------------------------------------------- # !!! USE CAUTION WHEN MODIFYING LINES BELOW -# Accepts a desired Nautobot version as build argument, default to 2.0.0 -ARG NAUTOBOT_VER="2.0.0-rc.2" +# Accepts a desired Nautobot version as build argument, default to 1.4.0 +ARG NAUTOBOT_VER="1.4.0" -# Accepts a desired Python version as build argument, default to 3.11 -ARG PYTHON_VER="3.11" +# Accepts a desired Python version as build argument, default to 3.8 +ARG PYTHON_VER="3.8" # Retrieve published development image of Nautobot base which should include most CI dependencies FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER} @@ -26,26 +26,25 @@ ENV NAUTOBOT_ROOT ${NAUTOBOT_ROOT} # and CI and local development may have a newer version of Poetry # Since this is only used for development and we don't ship this container, pinning Poetry back is not expressly necessary # We also don't need virtual environments in container -RUN curl -sSL https://install.python-poetry.org -o /tmp/install-poetry.py && \ - python /tmp/install-poetry.py && \ - rm -f /tmp/install-poetry.py && \ - poetry config virtualenvs.create false +RUN curl -sSL https://install.python-poetry.org | python3 - && \ + poetry config virtualenvs.create false # !!! USE CAUTION WHEN MODIFYING LINES ABOVE # ------------------------------------------------------------------------------------- -# Plugin-specific system build/test dependencies. -# +# App-specifc system build/test dependencies. +# # Example: LDAP requires `libldap2-dev` to be apt-installed before the Python package. # ------------------------------------------------------------------------------------- # --> Start safe to modify section -# Uncomment the line below if you are apt-installing any package. -# RUN apt update -# RUN apt install libldap2-dev +# Uncomment the lines below if you are apt-installing any package. +# RUN apt-get -y update && apt-get -y install \ +# libldap2-dev \ +# && rm -rf /var/lib/apt/lists/* # --> Stop safe to modify section # ------------------------------------------------------------------------------------- -# Install Nautobot Plugin +# Install Nautobot App # ------------------------------------------------------------------------------------- # !!! USE CAUTION WHEN MODIFYING LINES BELOW @@ -54,7 +53,7 @@ WORKDIR /source COPY . /source # Get container's installed Nautobot version as a forced constraint -# NAUTOBOT_VER may be a branch name and not a published release therefore we need to get the installed version +# NAUTOBOT_VER may be a branch name and not a published release therefor we need to get the installed version # so pip can use it to recognize local constraints. RUN pip show nautobot | grep "^Version: " | sed -e 's/Version: /nautobot==/' > constraints.txt @@ -68,7 +67,7 @@ RUN poetry export -f requirements.txt --with dev --without-hashes --output poetr RUN sort poetry_freeze_base.txt poetry_freeze_all.txt | uniq -u > poetry_freeze_dev.txt # Install all local project as editable, constrained on Nautobot version, to get any additional -# direct dependencies of the plugin +# direct dependencies of the app RUN pip install -c constraints.txt -e . # Install any dev dependencies frozen from Poetry diff --git a/development/development.env b/development/development.env index 080a7c71..54f0b870 100644 --- a/development/development.env +++ b/development/development.env @@ -7,8 +7,6 @@ NAUTOBOT_BANNER_TOP="Local" NAUTOBOT_CHANGELOG_RETENTION=0 NAUTOBOT_DEBUG=True -NAUTOBOT_DJANGO_EXTENSIONS_ENABLED=True -NAUTOBOT_DJANGO_TOOLBAR_ENABLED=True NAUTOBOT_LOG_LEVEL=DEBUG NAUTOBOT_METRICS_ENABLED=True NAUTOBOT_NAPALM_TIMEOUT=5 @@ -38,14 +36,3 @@ POSTGRES_DB=${NAUTOBOT_DB_NAME} MYSQL_USER=${NAUTOBOT_DB_USER} MYSQL_DATABASE=${NAUTOBOT_DB_NAME} MYSQL_ROOT_HOST=% - -# Golden Configuration specific -PER_FEATURE_WIDTH=13 -PER_FEATURE_HEIGHT=4 -PER_FEATURE_BAR_WIDTH=0.15 -ENABLE_COMPLIANCE=True -ENABLE_INTENDED=True -ENABLE_BACKUP=True -ENABLE_SOTAGG=True -ENABLE_POSTPROCESSING=True -ALLOWED_OS=all diff --git a/development/docker-compose.base.yml b/development/docker-compose.base.yml index 26356204..6a0a4c72 100644 --- a/development/docker-compose.base.yml +++ b/development/docker-compose.base.yml @@ -22,13 +22,13 @@ services: db: condition: "service_healthy" <<: - - *nautobot-build - *nautobot-base + - *nautobot-build worker: entrypoint: - "sh" - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env - - "nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL" ## $$ because of docker-compose + - "nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL --events" ## $$ because of docker-compose depends_on: - "nautobot" healthcheck: diff --git a/development/docker-compose.dev.yml b/development/docker-compose.dev.yml index b95ecb81..3374422a 100644 --- a/development/docker-compose.dev.yml +++ b/development/docker-compose.dev.yml @@ -12,13 +12,8 @@ services: volumes: - "./nautobot_config.py:/opt/nautobot/nautobot_config.py" - "../:/source" - # Helper method to mount on top of the python implementations, assuming you are using py3.11 and - # have all of your projects in the same directory. Uncomment out as required. - # - "../../netutils/netutils:/opt/nautobot/lib/python3.11/site-packages/netutils" - # - "../../nornir-nautobot/nornir_nautobot:/opt/nautobot/lib/python3.11/site-packages/nornir_nautobot" - # - "../../nautobot-plugin-nornir/nautobot_plugin_nornir:/opt/nautobot/lib/python3.11/site-packages/nautobot_plugin_nornir" - # - "../../nautobot/nautobot:/opt/nautobot/lib/python3.11/site-packages/nautobot" - + healthcheck: + test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test docs: entrypoint: "mkdocs serve -v -a 0.0.0.0:8080" ports: @@ -30,15 +25,15 @@ services: disable: true tty: true worker: + entrypoint: + - "sh" + - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env + - "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL --events" ## $$ because of docker-compose volumes: - "./nautobot_config.py:/opt/nautobot/nautobot_config.py" - "../:/source" - # Helper method to mount on top of the python implementations, assuming you are using py3.11 and - # have all of your projects in the same directory. Uncomment out as required. - # - "../../netutils/netutils:/opt/nautobot/lib/python3.11/site-packages/netutils" - # - "../../nornir-nautobot/nornir_nautobot:/opt/nautobot/lib/python3.11/site-packages/nornir_nautobot" - # - "../../nautobot-plugin-nornir/nautobot_plugin_nornir:/opt/nautobot/lib/python3.11/site-packages/nautobot_plugin_nornir" - # - "../../nautobot/nautobot:/opt/nautobot/lib/python3.11/site-packages/nautobot" + healthcheck: + test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test # To expose postgres or redis to the host uncomment the following # postgres: # ports: diff --git a/development/docker-compose.mysql.yml b/development/docker-compose.mysql.yml index c7fa6a1f..062ada94 100644 --- a/development/docker-compose.mysql.yml +++ b/development/docker-compose.mysql.yml @@ -20,6 +20,7 @@ services: image: "mysql:8" command: - "--default-authentication-plugin=mysql_native_password" + - "--max_connections=1000" env_file: - "development.env" - "creds.env" @@ -27,7 +28,12 @@ services: volumes: - "mysql_data:/var/lib/mysql" healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + test: + - "CMD" + - "mysqladmin" + - "ping" + - "-h" + - "localhost" timeout: "20s" retries: 10 volumes: diff --git a/development/docker-compose.postgres.yml b/development/docker-compose.postgres.yml index 55afdb70..12d1de31 100644 --- a/development/docker-compose.postgres.yml +++ b/development/docker-compose.postgres.yml @@ -7,11 +7,13 @@ services: - "NAUTOBOT_DB_ENGINE=django.db.backends.postgresql" db: image: "postgres:13-alpine" + command: + - "-c" + - "max_connections=200" env_file: - "development.env" - "creds.env" volumes: - # - "./nautobot.sql:/tmp/nautobot.sql" - "postgres_data:/var/lib/postgresql/data" healthcheck: test: "pg_isready --username=$$POSTGRES_USER --dbname=$$POSTGRES_DB" diff --git a/development/nautobot_config.py b/development/nautobot_config.py index 546c4417..f397ef56 100644 --- a/development/nautobot_config.py +++ b/development/nautobot_config.py @@ -1,13 +1,24 @@ """Nautobot development configuration file.""" -# pylint: disable=invalid-envvar-default import os import sys -from django.utils.module_loading import import_string - -from nautobot.core.settings import * # noqa: F403 +from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import from nautobot.core.settings_funcs import is_truthy, parse_redis_connection +# +# Debug +# + +DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False)) +_TESTING = len(sys.argv) > 1 and sys.argv[1] == "test" + +if DEBUG and not _TESTING: + DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: True} + + if "debug_toolbar" not in INSTALLED_APPS: # noqa: F405 + INSTALLED_APPS.append("debug_toolbar") # noqa: F405 + if "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405 + MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405 # # Misc. settings @@ -16,6 +27,9 @@ ALLOWED_HOSTS = os.getenv("NAUTOBOT_ALLOWED_HOSTS", "").split(" ") SECRET_KEY = os.getenv("NAUTOBOT_SECRET_KEY", "") +# +# Database +# nautobot_db_engine = os.getenv("NAUTOBOT_DB_ENGINE", "django.db.backends.postgresql") default_db_settings = { @@ -45,18 +59,28 @@ DATABASES["default"]["OPTIONS"] = {"charset": "utf8mb4"} # -# Debug +# Redis # -DEBUG = True +# The django-redis cache is used to establish concurrent locks using Redis. +CACHES = { + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": parse_redis_connection(redis_database=0), + "TIMEOUT": 300, + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + }, + } +} -# Django Debug Toolbar -DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: DEBUG and not TESTING} +# Redis Cacheops +CACHEOPS_REDIS = parse_redis_connection(redis_database=1) -if DEBUG and "debug_toolbar" not in INSTALLED_APPS: # noqa: F405 - INSTALLED_APPS.append("debug_toolbar") # noqa: F405 -if DEBUG and "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405 - MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405 +# +# Celery settings are not defined here because they can be overloaded with +# environment variables. By default they use `CACHES["default"]["LOCATION"]`. +# # # Logging @@ -64,10 +88,8 @@ LOG_LEVEL = "DEBUG" if DEBUG else "INFO" -TESTING = len(sys.argv) > 1 and sys.argv[1] == "test" - # Verbose logging during normal development operation, but quiet logging during unit test execution -if not TESTING: +if not _TESTING: LOGGING = { "version": 1, "disable_existing_loggers": False, @@ -101,114 +123,19 @@ }, }, } -else: - LOGGING = {} - -# -# Redis -# - -# The django-redis cache is used to establish concurrent locks using Redis. The -# django-rq settings will use the same instance/database by default. -# -# This "default" server is now used by RQ_QUEUES. -# >> See: nautobot.core.settings.RQ_QUEUES -CACHES = { - "default": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": parse_redis_connection(redis_database=0), - "TIMEOUT": 300, - "OPTIONS": { - "CLIENT_CLASS": "django_redis.client.DefaultClient", - }, - } -} - -# RQ_QUEUES is not set here because it just uses the default that gets imported -# up top via `from nautobot.core.settings import *`. - -# Redis Cacheops -CACHEOPS_REDIS = parse_redis_connection(redis_database=1) # -# Celery settings are not defined here because they can be overloaded with -# environment variables. By default they use `CACHES["default"]["LOCATION"]`. +# Apps # - -# Enable installed plugins. Add the name of each plugin to the list. -PLUGINS = ["nautobot_plugin_nornir", "nautobot_golden_config"] - -# Plugins configuration settings. These settings are used by various plugins that the user may have installed. -# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings. -PLUGINS_CONFIG = { - "nautobot_plugin_nornir": { - "nornir_settings": { - "credentials": "nautobot_plugin_nornir.plugins.credentials.env_vars.CredentialsEnvVars", - "runner": { - "plugin": "threaded", - "options": { - "num_workers": 20, - }, - }, - }, - # dispatcher_mapping may be necessary if you get an error `Cannot import "". Is the library installed?` - # when you run a backup job, and is the name of the platform applied to the device. - # to the Nornir driver names ("arista_eos", "cisco_ios", etc.). - # "dispatcher_mapping": { - # "eos": "nornir_nautobot.plugins.tasks.dispatcher.arista_eos.NautobotNornirDriver", - # "arbitrary_platform_name": "nornir_nautobot.plugins.tasks.dispatcher.arista_eos.NautobotNornirDriver", - # "ios": "nornir_nautobot.plugins.tasks.dispatcher.cisco_ios.NautobotNornirDriver", - # "iosxe": "nornir_nautobot.plugins.tasks.dispatcher.cisco_ios.NautobotNornirDriver", - # "junos": "nornir_nautobot.plugins.tasks.dispatcher.juniper_junos.NautobotNornirDriver", - # "nxos": "nornir_nautobot.plugins.tasks.dispatcher.cisco_nxos.NautobotNornirDriver", - # }, - }, - "nautobot_golden_config": { - "per_feature_bar_width": float(os.environ.get("PER_FEATURE_BAR_WIDTH", 0.15)), - "per_feature_width": int(os.environ.get("PER_FEATURE_WIDTH", 13)), - "per_feature_height": int(os.environ.get("PER_FEATURE_HEIGHT", 4)), - "enable_backup": is_truthy(os.environ.get("ENABLE_BACKUP", True)), - "enable_compliance": is_truthy(os.environ.get("ENABLE_COMPLIANCE", True)), - "enable_intended": is_truthy(os.environ.get("ENABLE_INTENDED", True)), - "enable_sotagg": is_truthy(os.environ.get("ENABLE_SOTAGG", True)), - "sot_agg_transposer": os.environ.get("SOT_AGG_TRANSPOSER"), - "enable_postprocessing": is_truthy(os.environ.get("ENABLE_POSTPROCESSING", True)), - "postprocessing_callables": os.environ.get("POSTPROCESSING_CALLABLES", []), - "postprocessing_subscribed": os.environ.get("POSTPROCESSING_SUBSCRIBED", []), - "jinja_env": { - "undefined": import_string("jinja2.StrictUndefined"), - "trim_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_TRIM_BLOCKS", True)), - "lstrip_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_LSTRIP_BLOCKS", False)), - }, - # The platform_network_driver_map maps an arbitrary platform network_driver to its corresponding parser. - # Use this if the platform network_driver names in your Nautobot instance don't correspond exactly - # to the Nornir driver names ("arista_eos", "cisco_ios", etc.). - # Each key should == the network_driver of the Nautobot platform object. - # "platform_network_driver_map": { - # "eos": "arista_eos", - # "ios": "cisco_ios", - # "iosxe": "cisco_ios", - # "junos": "juniper_junos", - # "nxos": "cisco_nxos", - # }, - # "get_custom_compliance": "my.custom_compliance.func", - }, -} - -# Modify django_jinja Environment for test cases -django_jinja_config = None -for template in TEMPLATES: - if template["BACKEND"].startswith("django_jinja"): - django_jinja_config = template - -if django_jinja_config is not None: - jinja_options = django_jinja_config.get("OPTIONS") - if not jinja_options: - jinja_options = {} - django_jinja_config["OPTIONS"] = jinja_options - # Default behavior ignores UndefinedErrors - jinja_options["undefined"] = "jinja2.StrictUndefined" - -# Import filter function to have it register filter with django_jinja -from nautobot_golden_config.tests import jinja_filters # noqa: E402 +# Enable installed Apps. Add the name of each App to the list. +PLUGINS = ["nautobot_golden_config"] + +# Apps configuration settings. These settings are used by various Apps that the user may have installed. +# Each key in the dictionary is the name of an installed App and its value is a dictionary of settings. +# PLUGINS_CONFIG = { +# 'nautobot_golden_config': { +# 'foo': 'bar', +# 'buzz': 'bazz' +# } +# } diff --git a/docs/admin/compatibility_matrix.md b/docs/admin/compatibility_matrix.md index 5b6e64ae..acd191eb 100644 --- a/docs/admin/compatibility_matrix.md +++ b/docs/admin/compatibility_matrix.md @@ -1,18 +1,8 @@ # Compatibility Matrix -Changes to the support of upstream Nautobot releases will be announced 1 minor or major version ahead. - -The **deprecation policy** will be announced within the [release notes](../release_notes), and updated in the table below. There will be a `stable-.` branch that will be minimally maintained. Any security enhancements or major bugs in that branch will be supported for a limited time. - -While that last supported version will not be strictly enforced via the `max_version` setting, any issues with an updated Nautobot supported version in a minor release will require raising a bug and fixing it in Nautobot core, with no fixes expected in this plugin. This allows the Golden Config plugin the ability to quickly take advantage of the latest features in Nautobot. +!!! warning "Developer Note - Remove Me!" + Explain how the release models of the plugin and of Nautobot work together, how releases are supported, how features and older releases are deprecated etc. | Golden Config Version | Nautobot First Support Version | Nautobot Last Support Version | -| --------------------- | ------------------------------ | ----------------------------- | -| 0.9.X | 1.0.0 | 1.2.99 [Official] | -| 0.10.X | 1.0.0 | 1.2.99 [Official] | -| 1.0.X | 1.2.0 | 1.3.99 [Official] | -| 1.1.X | 1.2.0 | 1.3.99 [Official] | -| 1.2.X | 1.4.0 | 1.5.2 [Official] | -| 1.3.X | 1.4.0 | 1.5.2 [Official] | -| 1.4.X | 1.5.3 | 1.5.99 [Official] | -| 1.5.X | 1.6.1 | 1.6.99 [Official] | +| ------------- | -------------------- | ------------- | +| 1.0.X | 1.4.0 | 1.99.99 | diff --git a/docs/admin/install.md b/docs/admin/install.md new file mode 100644 index 00000000..2e06f44f --- /dev/null +++ b/docs/admin/install.md @@ -0,0 +1,81 @@ +# Installing the App in Nautobot + +Here you will find detailed instructions on how to **install** and **configure** the App within your Nautobot environment. + +!!! warning "Developer Note - Remove Me!" + Detailed instructions on installing the App. You will need to update this section based on any additional dependencies or prerequisites. + +## Prerequisites + +- The plugin is compatible with Nautobot 1.4.0 and higher. +- Databases supported: PostgreSQL, MySQL + +!!! note + Please check the [dedicated page](compatibility_matrix.md) for a full compatibility matrix and the deprecation policy. + +### Access Requirements + +!!! warning "Developer Note - Remove Me!" + What external systems (if any) it needs access to in order to work. + +## Install Guide + +!!! note + Plugins can be installed manually or using Python's `pip`. See the [nautobot documentation](https://nautobot.readthedocs.io/en/latest/plugins/#install-the-package) for more details. The pip package name for this plugin is [`nautobot-golden-config`](https://pypi.org/project/nautobot-golden-config/). + +The plugin is available as a Python package via PyPI and can be installed with `pip`: + +```shell +pip install nautobot-golden-config +``` + +To ensure Golden Config is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the Nautobot root directory (alongside `requirements.txt`) and list the `nautobot-golden-config` package: + +```shell +echo nautobot-golden-config >> local_requirements.txt +``` + +Once installed, the plugin needs to be enabled in your Nautobot configuration. The following block of code below shows the additional configuration required to be added to your `nautobot_config.py` file: + +- Append `"nautobot_golden_config"` to the `PLUGINS` list. +- Append the `"nautobot_golden_config"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults. + +```python +# In your nautobot_config.py +PLUGINS = ["nautobot_golden_config"] + +# PLUGINS_CONFIG = { +# "nautobot_golden_config": { +# ADD YOUR SETTINGS HERE +# } +# } +``` + +Once the Nautobot configuration is updated, run the Post Upgrade command (`nautobot-server post_upgrade`) to run migrations and clear any cache: + +```shell +nautobot-server post_upgrade +``` + +Then restart (if necessary) the Nautobot services which may include: + +- Nautobot +- Nautobot Workers +- Nautobot Scheduler + +```shell +sudo systemctl restart nautobot nautobot-worker nautobot-scheduler +``` + +## App Configuration + +!!! warning "Developer Note - Remove Me!" + Any configuration required to get the App set up. Edit the table below as per the examples provided. + +The plugin behavior can be controlled with the following list of settings: + +| Key | Example | Default | Description | +| ------- | ------ | -------- | ------------------------------------- | +| `enable_backup` | `True` | `True` | A boolean to represent whether or not to run backup configurations within the plugin. | +| `platform_slug_map` | `{"cisco_wlc": "cisco_aireos"}` | `None` | A dictionary in which the key is the platform slug and the value is what netutils uses in any "network_os" parameter. | +| `per_feature_bar_width` | `0.15` | `0.15` | The width of the table bar within the overview report | diff --git a/docs/admin/release_notes/version_1.0.md b/docs/admin/release_notes/version_1.0.md index 136334d5..4a9c9a8b 100644 --- a/docs/admin/release_notes/version_1.0.md +++ b/docs/admin/release_notes/version_1.0.md @@ -1,64 +1,48 @@ # v1.0 Release Notes -- Added support for Jinja2Filters to be be used in configuration generation -- Added support for multiple repos -- Add Git datasource to load GC properties -- Added support for nautobot secrets group on git repos -- Changed the release policy -- Updated navigation to a dedicated top level menu +!!! warning "Developer Note - Remove Me!" + Guiding Principles: -## v1.0.3 - 2022-06 + - Changelogs are for humans, not machines. + - There should be an entry for every single version. + - The same types of changes should be grouped. + - Versions and sections should be linkable. + - The latest version comes first. + - The release date of each version is displayed. + - Mention whether you follow Semantic Versioning. -### Fixed + Types of changes: -- [#257](https://github.com/nautobot/nautobot-plugin-golden-config/issues/257) Resolved template_content displaying SoT AGG link on Device detail page if Device not in scope of GoldenConfigSetting - - Change to pull version from package instead of static variable + - `Added` for new features. + - `Changed` for changes in existing functionality. + - `Deprecated` for soon-to-be removed features. + - `Removed` for now removed features. + - `Fixed` for any bug fixes. + - `Security` in case of vulnerabilities. -## v1.0.2 - 2022-05 -### Fixed +This document describes all new features and changes in the release `1.0`. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Release Overview + +- Major features or milestones +- Achieved in this `x.y` release +- Changes to compatibility with Nautobot and/or other plugins, libraries etc. + +## [v1.0.1] - 2021-09-08 -- [#246](https://github.com/nautobot/nautobot-plugin-golden-config/issues/246) Dependabot update to Docker redis-7.x -- [#233](https://github.com/nautobot/nautobot-plugin-golden-config/issues/233) Dependabot update to paramiko-2.10.1 -- [#251](https://github.com/nautobot/nautobot-plugin-golden-config/issues/251) Add description to CSV config replace export +### Added -## v1.0.1 - 2022-05 +### Changed ### Fixed -- [#238](https://github.com/nautobot/nautobot-plugin-golden-config/issues/238) Fixed repo/docs/homepage links for PyPI -- [#243](https://github.com/nautobot/nautobot-plugin-golden-config/issues/243) Removing unneed javascript source as it is part of [#243](https://github.com/nautobot/nautobot-plugin-golden-config/pull/243) +- [#123](https://github.com/nautobot/nautobot-plugin-golden-config/issues/123) Fixed Tag filtering not working in job launch form -## v1.0.0 - 2022-04 +## [v1.0.0] - 2021-08-03 ### Added -- [#180](https://github.com/nautobot/nautobot-plugin-golden-config/issues/180) Added Renovate for proactive package management -- [#158](https://github.com/nautobot/nautobot-plugin-golden-config/issues/158) Allow for Jinja2 Filters to be used by GoldenConfig templates -- [#167](https://github.com/nautobot/nautobot-plugin-golden-config/issues/167) Added support for multiple repos -- [#205](https://github.com/nautobot/nautobot-plugin-golden-config/issues/205) Added support for multiple repos via multiple golden config settings -- [#206](https://github.com/nautobot/nautobot-plugin-golden-config/issues/206) Add Git datasource to load GC properties -- [#218](https://github.com/nautobot/nautobot-plugin-golden-config/issues/218) Added ability to storre SoTAgg field leveraging Nautobot saved GraphQl query -- [#225](https://github.com/nautobot/nautobot-plugin-golden-config/issues/225) Added support for nautobot secrets group on git repos -- [#234](https://github.com/nautobot/nautobot-plugin-golden-config/issues/234) Minor update to FAQ - ### Changed -- [#171](https://github.com/nautobot/nautobot-plugin-golden-config/issues/171) Changed the release policy -- [#158](https://github.com/nautobot/nautobot-plugin-golden-config/issues/158) Changed variable job_result to nautobot_job -- [#186](https://github.com/nautobot/nautobot-plugin-golden-config/issues/186) Update mariadb Docker tag to v10.7 -- [#187](https://github.com/nautobot/nautobot-plugin-golden-config/issues/187) Update postgres Docker tag to v14 -- [#188](https://github.com/nautobot/nautobot-plugin-golden-config/issues/188) Update Markdown dependency -- [#190](https://github.com/nautobot/nautobot-plugin-golden-config/issues/190) Update to Nautobot 1.2.0 -- [#190](https://github.com/nautobot/nautobot-plugin-golden-config/issues/190) Remove Nautobot 1.0 specific code -- [#211](https://github.com/nautobot/nautobot-plugin-golden-config/issues/211) Update dependency mariadb to v10.8 -- [#229](https://github.com/nautobot/nautobot-plugin-golden-config/issues/229) Updated navigation to a dedicated top level menu - ### Fixed - -- [#176](https://github.com/nautobot/nautobot-plugin-golden-config/issues/176) Fixed Pylint issue -- [#182](https://github.com/nautobot/nautobot-plugin-golden-config/issues/182) Add reference to Nornir plugin for installation -- [#183](https://github.com/nautobot/nautobot-plugin-golden-config/issues/183) Fixed documentation for sot_agg_transposer default -- [#184](https://github.com/nautobot/nautobot-plugin-golden-config/issues/184) Fix markdown links in quick-start -- [#194](https://github.com/nautobot/nautobot-plugin-golden-config/issues/194) Detailed Error Handling in get_job_filter helper -- [#229](https://github.com/nautobot/nautobot-plugin-golden-config/issues/229) Fixed [#165](https://github.com/nautobot/nautobot-plugin-golden-config/pull/165), Configuration Compliance List View "Device" filter doesn't work diff --git a/docs/admin/uninstall.md b/docs/admin/uninstall.md new file mode 100644 index 00000000..a30679d5 --- /dev/null +++ b/docs/admin/uninstall.md @@ -0,0 +1,18 @@ +# Uninstall the App from Nautobot + +Here you will find any steps necessary to cleanly remove the App from your Nautobot environment. + +## Database Cleanup + +Prior to removing the plugin from the `nautobot_config.py`, run the following command to roll back any migration specific to this plugin. + +```shell +nautobot-server migrate nautobot_plugin_golden_config zero +``` + +!!! warning "Developer Note - Remove Me!" + Any other cleanup operations to ensure the database is clean after the app is removed. Is there anything else that needs cleaning up, such as CFs, relationships, etc. if they're no longer desired? + +## Remove App configuration + +Remove the configuration you added in `nautobot_config.py` from `PLUGINS` & `PLUGINS_CONFIG`. diff --git a/docs/admin/upgrade.md b/docs/admin/upgrade.md new file mode 100644 index 00000000..3b87d56f --- /dev/null +++ b/docs/admin/upgrade.md @@ -0,0 +1,10 @@ +# Upgrading the App + +Here you will find any steps necessary to upgrade the App in your Nautobot environment. + +## Upgrade Guide + +!!! warning "Developer Note - Remove Me!" + Add more detailed steps on how the app is upgraded in an existing Nautobot setup and any version specifics (such as upgrading between major versions with breaking changes). + +When a new release comes out it may be necessary to run a migration of the database to account for any changes in the data models used by this plugin. Execute the command `nautobot-server post-upgrade` within the runtime environment of your Nautobot installation after updating the `nautobot-golden-config` package via `pip`. diff --git a/docs/assets/extra.css b/docs/assets/extra.css index 131cef77..dfe2e4b1 100644 --- a/docs/assets/extra.css +++ b/docs/assets/extra.css @@ -18,6 +18,15 @@ font-size: 0.7rem; } +/* +* The default max-width is 61rem which does not provide nearly enough space to present code examples or larger tables +*/ +.md-grid { + margin-left: auto; + margin-right: auto; + max-width: 95%; +} + .md-tabs__link { font-size: 0.8rem; } @@ -39,7 +48,7 @@ } img.logo { - height: 100px; + height: 200px; } img.copyright-logo { @@ -85,3 +94,68 @@ a.autorefs-external::after { a.autorefs-external:hover::after { background-color: var(--md-accent-fg-color); } + + +/* Customization for mkdocs-version-annotations */ +:root { + /* Icon for "version-added" admonition: Material Design Icons "plus-box-outline" */ + --md-admonition-icon--version-added: url('data:image/svg+xml;charset=utf-8,'); + /* Icon for "version-changed" admonition: Material Design Icons "delta" */ + --md-admonition-icon--version-changed: url('data:image/svg+xml;charset=utf-8,'); + /* Icon for "version-removed" admonition: Material Design Icons "minus-circle-outline" */ + --md-admonition-icon--version-removed: url('data:image/svg+xml;charset=utf-8,'); +} + +/* "version-added" admonition in green */ +.md-typeset .admonition.version-added, +.md-typeset details.version-added { + border-color: rgb(0, 200, 83); +} + +.md-typeset .version-added>.admonition-title, +.md-typeset .version-added>summary { + background-color: rgba(0, 200, 83, .1); +} + +.md-typeset .version-added>.admonition-title::before, +.md-typeset .version-added>summary::before { + background-color: rgb(0, 200, 83); + -webkit-mask-image: var(--md-admonition-icon--version-added); + mask-image: var(--md-admonition-icon--version-added); +} + +/* "version-changed" admonition in orange */ +.md-typeset .admonition.version-changed, +.md-typeset details.version-changed { + border-color: rgb(255, 145, 0); +} + +.md-typeset .version-changed>.admonition-title, +.md-typeset .version-changed>summary { + background-color: rgba(255, 145, 0, .1); +} + +.md-typeset .version-changed>.admonition-title::before, +.md-typeset .version-changed>summary::before { + background-color: rgb(255, 145, 0); + -webkit-mask-image: var(--md-admonition-icon--version-changed); + mask-image: var(--md-admonition-icon--version-changed); +} + +/* "version-removed" admonition in red */ +.md-typeset .admonition.version-removed, +.md-typeset details.version-removed { + border-color: rgb(255, 82, 82); +} + +.md-typeset .version-removed>.admonition-title, +.md-typeset .version-removed>summary { + background-color: rgba(255, 82, 82, .1); +} + +.md-typeset .version-removed>.admonition-title::before, +.md-typeset .version-removed>summary::before { + background-color: rgb(255, 82, 82); + -webkit-mask-image: var(--md-admonition-icon--version-removed); + mask-image: var(--md-admonition-icon--version-removed); +} diff --git a/docs/assets/overrides/partials/copyright.html b/docs/assets/overrides/partials/copyright.html index e0b77e5f..b92cf5e3 100644 --- a/docs/assets/overrides/partials/copyright.html +++ b/docs/assets/overrides/partials/copyright.html @@ -1,3 +1,4 @@ +