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

Update for Nautobot v2 #47

Merged
merged 17 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ ignore: |
.venv/
nautobot-app/{{ cookiecutter.project_slug }}/invoke.mysql.yml
nautobot-app/{{ cookiecutter.project_slug }}/invoke.example.yml
nautobot-app-ssot/{{ cookiecutter.project_slug }}/invoke.mysql.yml
nautobot-app-ssot/{{ cookiecutter.project_slug }}/invoke.example.yml
2 changes: 1 addition & 1 deletion nautobot-app-ssot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The term SSoT, or Single Source of Truth, refers to the intention of using Nauto

### IMPORTANT Cookie Notes

- The logo of the project is a placeholder (`docs/images/icon-{{cookiecutter.plugin_slug}}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background!
- The logo of the project is a placeholder (`docs/images/icon-{{ cookiecutter.plugin_slug }}.png`) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background!
- Please resolve and remove **all** of the comments and blocks marked with `Developer Note - Remove Me!` prior to publishing the documentation. Catch'em all with `rgrep "Developer Note"`.
- The documentation website will be built and hosted on `readthedocs.io` for open source projects and follows the standard Network to Code branding for all our open source projects.

Expand Down
26 changes: 13 additions & 13 deletions nautobot-app-ssot/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"email": "[email protected]",
"github_org": "nautobot",
"system_of_record": "System of Record",
"system_of_record_camel": "{{cookiecutter.system_of_record.title().replace(' ', '').replace('_', '').replace('-', '')}}",
"system_of_record_slug": "{{cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_')}}",
"plugin_name": "nautobot_ssot_{{cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_')}}",
"verbose_name": "{{cookiecutter.plugin_name.title().replace('_', ' ')}}",
"plugin_slug": "{{cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-')}}",
"project_slug": "nautobot-plugin-ssot-{{cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-')}}",
"repo_url": "https://github.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}",
"base_url": "ssot-{{cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-')}}",
"min_nautobot_version": "1.6.0",
"max_nautobot_version": "1.9999",
"camel_name": "{{cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '')}}",
"project_short_description": "{{cookiecutter.verbose_name}}",
"system_of_record_camel": "{{ cookiecutter.system_of_record.title().replace(' ', '').replace('_', '').replace('-', '') }}",
"system_of_record_slug": "{{ cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_') }}",
"plugin_name": "nautobot_ssot_{{ cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_') }}",
"verbose_name": "{{ cookiecutter.plugin_name.title().replace('_', ' ') }}",
"plugin_slug": "{{ cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-') }}",
"project_slug": "nautobot-plugin-ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}",
"repo_url": "https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}",
"base_url": "ssot-{{ cookiecutter.system_of_record.lower().replace(' ', '-').replace('_', '-') }}",
"min_nautobot_version": "2.0.0",
"max_nautobot_version": "2.9999",
"camel_name": "{{ cookiecutter.plugin_slug.title().replace(' ', '').replace('-', '') }}",
"project_short_description": "{{ cookiecutter.verbose_name }}",
"model_class_name": "None",
"open_source_license": [
"Apache-2.0",
"Not open source"
],
"docs_base_url": "https://docs.nautobot.com",
"docs_app_url": "{{cookiecutter.docs_base_url}}/projects/{{cookiecutter.plugin_slug}}/en/latest"
"docs_app_url": "{{ cookiecutter.docs_base_url }}/projects/{{ cookiecutter.plugin_slug }}/en/latest"
}
36 changes: 18 additions & 18 deletions nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{cookiecutter.verbose_name}} SSoT
# {{ cookiecutter.verbose_name }} SSoT

A plugin for [Nautobot](https://github.com/nautobot/nautobot).

Expand All @@ -9,18 +9,18 @@ Developer Note - Remove Me!

The README will have certain links/images broken until the PR is merged into `develop`. Update the GitHub links with whichever branch you're using (main etc.) if different.

The logo of the project is a placeholder (docs/images/icon-{{cookiecutter.plugin_slug}}.png) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background!
The logo of the project is a placeholder (docs/images/icon-{{ cookiecutter.plugin_slug }}.png) - please replace it with your app icon, making sure it's at least 200x200px and has a transparent background!

To avoid extra work and temporary links, make sure that publishing docs (or merging a PR) is done at the same time as setting up the docs site on RTD, then test everything.
-->

<p align="center">
<img src="https://raw.githubusercontent.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}/develop/docs/images/icon-{{cookiecutter.plugin_slug}}.png" class="logo" height="200px">
<img src="https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/icon-{{ cookiecutter.plugin_slug }}.png" class="logo" height="200px">
<br>
<a href="{{cookiecutter.repo_url}}/actions"><img src="{{cookiecutter.repo_url}}/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="{{cookiecutter.docs_app_url}}"><img src="https://readthedocs.org/projects/{{cookiecutter.project_slug}}/badge/"></a>
<a href="https://pypi.org/project/{{cookiecutter.plugin_slug}}/"><img src="https://img.shields.io/pypi/v/{{cookiecutter.plugin_slug}}"></a>
<a href="https://pypi.org/project/{{cookiecutter.plugin_slug}}/"><img src="https://img.shields.io/pypi/dm/{{cookiecutter.plugin_slug}}"></a>
<a href="{{ cookiecutter.repo_url }}/actions"><img src="{{ cookiecutter.repo_url }}/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="{{ cookiecutter.docs_app_url }}"><img src="https://readthedocs.org/projects/{{ cookiecutter.project_slug }}/badge/"></a>
<a href="https://pypi.org/project/{{ cookiecutter.plugin_slug }}/"><img src="https://img.shields.io/pypi/v/{{ cookiecutter.plugin_slug }}"></a>
<a href="https://pypi.org/project/{{ cookiecutter.plugin_slug }}/"><img src="https://img.shields.io/pypi/dm/{{ cookiecutter.plugin_slug }}"></a>
<br>
An <a href="https://www.networktocode.com/nautobot/apps/">App</a> for <a href="https://nautobot.com/">Nautobot</a>.
</p>
Expand All @@ -35,9 +35,9 @@ To avoid extra work and temporary links, make sure that publishing docs (or merg

> 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/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/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.

More screenshots can be found in the [Using the App]({{cookiecutter.docs_app_url}}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality:
More screenshots can be found in the [Using the App]({{ cookiecutter.docs_app_url }}/user/app_use_cases/) page in the documentation. Here's a quick overview of some of the plugin's added functionality:

![](https://raw.githubusercontent.com/{{cookiecutter.github_org}}/{{cookiecutter.project_slug}}/develop/docs/images/placeholder.png)
![](https://raw.githubusercontent.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_slug }}/develop/docs/images/placeholder.png)

## Try it out!

Expand All @@ -49,22 +49,22 @@ This App is installed in the Nautobot Community Sandbox found over at [demo.naut

## Documentation

Full documentation for this App can be found over on the [Nautobot Docs]({{cookiecutter.docs_base_url}}) website:
Full documentation for this App can be found over on the [Nautobot Docs]({{ cookiecutter.docs_base_url }}) website:

- [User Guide]({{cookiecutter.docs_app_url}}/user/app_overview/) - Overview, Using the App, Getting Started.
- [Administrator Guide]({{cookiecutter.docs_app_url}}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App.
- [Developer Guide]({{cookiecutter.docs_app_url}}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide.
- [Release Notes / Changelog]({{cookiecutter.docs_app_url}}/admin/release_notes/).
- [Frequently Asked Questions]({{cookiecutter.docs_app_url}}/user/faq/).
- [User Guide]({{ cookiecutter.docs_app_url }}/user/app_overview/) - Overview, Using the App, Getting Started.
- [Administrator Guide]({{ cookiecutter.docs_app_url }}/admin/install/) - How to Install, Configure, Upgrade, or Uninstall the App.
- [Developer Guide]({{ cookiecutter.docs_app_url }}/dev/contributing/) - Extending the App, Code Reference, Contribution Guide.
- [Release Notes / Changelog]({{ cookiecutter.docs_app_url }}/admin/release_notes/).
- [Frequently Asked Questions]({{ cookiecutter.docs_app_url }}/user/faq/).

### Contributing to the Documentation

You can find all the Markdown source for the App documentation under the [`docs`]({{cookiecutter.repo_url}}/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`]({{ cookiecutter.repo_url }}/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 documentation can be started using the `invoke` commands (details in the [Development Environment Guide]({{cookiecutter.docs_app_url}}/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.
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]({{ cookiecutter.docs_app_url }}/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]({{cookiecutter.docs_app_url}}/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.
For any questions or comments, please check the [FAQ]({{ cookiecutter.docs_app_url }}/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.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
# Enable installed Apps. Add the name of each App to the list.
PLUGINS = [
"nautobot_ssot",
"{{cookiecutter.plugin_name}}",
"{{ cookiecutter.plugin_name }}",
]

# Apps configuration settings. These settings are used by various Apps that the user may have installed.
Expand All @@ -140,7 +140,7 @@
"nautobot_ssot": {
"hide_example_jobs": True,
},
# '{{cookiecutter.plugin_name}}': {
# '{{ cookiecutter.plugin_name }}': {
# 'foo': 'bar',
# 'buzz': 'bazz',
# },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Here you will find detailed instructions on how to **install** and **configure**

## Prerequisites

- The plugin is compatible with Nautobot {{cookiecutter.min_nautobot_version}} and higher.
- The plugin is compatible with Nautobot {{ cookiecutter.min_nautobot_version }} and higher.
- Databases supported: PostgreSQL, MySQL

!!! note
Expand All @@ -21,37 +21,37 @@ Here you will find detailed instructions on how to **install** and **configure**
## 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 [`{{cookiecutter.plugin_slug}}`](https://pypi.org/project/{{cookiecutter.plugin_slug}}/).
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 [`{{ cookiecutter.plugin_slug }}`](https://pypi.org/project/{{ cookiecutter.plugin_slug }}/).

The plugin is available as a Python package via PyPI and can be installed with `pip`:

```shell
pip install {{cookiecutter.plugin_slug}}
pip install {{ cookiecutter.plugin_slug }}
```

To ensure {{cookiecutter.verbose_name}} 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 `{{cookiecutter.plugin_slug}}` package:
To ensure {{ cookiecutter.verbose_name }} 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 `{{ cookiecutter.plugin_slug }}` package:

```shell
echo {{cookiecutter.plugin_slug}} >> local_requirements.txt
echo {{ cookiecutter.plugin_slug }} >> 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 `"{{cookiecutter.plugin_name}}"` to the `PLUGINS` list.
- Append the `"{{cookiecutter.plugin_name}}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults.
- Append `"{{ cookiecutter.plugin_name }}"` to the `PLUGINS` list.
- Append the `"{{ cookiecutter.plugin_name }}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults.

```python
# In your nautobot_config.py
PLUGINS = [
"nautobot_ssot",
"{{cookiecutter.plugin_name}}",
"{{ cookiecutter.plugin_name }}",
]

PLUGINS_CONFIG = {
"nautobot_ssot": {
"hide_example_jobs": True,
},
'{{cookiecutter.plugin_name}}': {
'{{ cookiecutter.plugin_name }}': {
# ADD YOUR SETTINGS HERE
},
}
Expand Down

This file was deleted.

24 changes: 14 additions & 10 deletions nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "{{cookiecutter.plugin_slug}}"
name = "{{ cookiecutter.plugin_slug }}"
version = "0.1.0"
description = "{{cookiecutter.project_short_description}}"
authors = ["{{cookiecutter.full_name}} <{{cookiecutter.email}}>"]
description = "{{ cookiecutter.project_short_description }}"
authors = ["{{ cookiecutter.full_name }} <{{ cookiecutter.email }}>"]
{%- if cookiecutter.open_source_license == 'Apache-2.0' %}
license = "{{cookiecutter.open_source_license}}"
license = "{{ cookiecutter.open_source_license }}"
{%- endif %}
readme = "README.md"
homepage = "{{cookiecutter.repo_url}}"
repository = "{{cookiecutter.repo_url}}"
homepage = "{{ cookiecutter.repo_url }}"
repository = "{{ cookiecutter.repo_url }}"
keywords = ["nautobot", "nautobot-plugin"]
classifiers = [
"Intended Audience :: Developers",
Expand All @@ -26,14 +26,14 @@ include = [
"README.md",
]
packages = [
{ include = "{{cookiecutter.plugin_name}}" },
{ include = "{{ cookiecutter.plugin_name }}" },
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
# Used for local development
nautobot = "^{{cookiecutter.min_nautobot_version}}"
nautobot-ssot = "^1.1.0"
nautobot = "^{{ cookiecutter.min_nautobot_version }}"
nautobot-ssot = "^2.0.0"

[tool.poetry.group.dev.dependencies]
bandit = "*"
Expand All @@ -60,6 +60,10 @@ mkdocs-version-annotations = "1.0.0"
mkdocstrings = "0.22.0"
mkdocstrings-python = "1.5.2"

[tool.poetry.extras]
all = [
]

[tool.black]
line-length = 120
target-version = ['py38', 'py39', 'py310', 'py311']
Expand Down Expand Up @@ -108,7 +112,7 @@ notes = """,

[tool.pylint-nautobot]
supported_nautobot_versions = [
"{{cookiecutter.min_nautobot_version}}"
"{{ cookiecutter.min_nautobot_version }}"
]

[tool.pydocstyle]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Device(DiffSyncModel):
"status",
"role",
"model",
"site",
"location",
"ip_address",
)
_children = {}
Expand All @@ -22,7 +22,7 @@ class Device(DiffSyncModel):
status: Optional[str]
role: Optional[str]
model: Optional[str]
site: Optional[str]
location: Optional[str]
ip_address: Optional[str]

uuid: Optional[UUID]
Loading