Skip to content

Commit

Permalink
Merge pull request #54 from nautobot/u/whitej6-rename-to-app
Browse files Browse the repository at this point in the history
rename plugin to app globally
  • Loading branch information
whitej6 authored Dec 19, 2023
2 parents a1d0a48 + c9b87b5 commit 3ca8aca
Show file tree
Hide file tree
Showing 131 changed files with 343 additions and 344 deletions.
30 changes: 15 additions & 15 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ docker compose run --rm -- dev cookiecutter --output-dir=./outputs ./nautobot-
[2/18] full_name (Network to Code, LLC):
[3/18] email ([email protected]):
[4/18] github_org (nautobot):
[5/18] plugin_name (my_plugin):
[6/18] verbose_name (My Plugin):
[7/18] plugin_slug (my-plugin):
[8/18] project_slug (nautobot-plugin-my-plugin):
[9/18] repo_url (https://github.com/nautobot/nautobot-plugin-my-plugin):
[10/18] base_url (my-plugin):
[5/18] app_name (my_app):
[6/18] verbose_name (My App):
[7/18] app_slug (my-app):
[8/18] project_slug (nautobot-app-my-app):
[9/18] repo_url (https://github.com/nautobot/nautobot-app-my-app):
[10/18] base_url (my-app):
[11/18] min_nautobot_version (1.6.0):
[12/18] max_nautobot_version (1.9999):
[13/18] camel_name (MyPlugin):
[14/18] project_short_description (My Plugin):
[13/18] camel_name (MyApp):
[14/18] project_short_description (My App):
[15/18] model_class_name (None):
[16/18] Select open_source_license
1 - Apache-2.0
2 - Not open source
Choose from [1/2] (1):
[17/18] docs_base_url (https://docs.nautobot.com):
[18/18] docs_app_url (https://docs.nautobot.com/projects/my-plugin/en/latest):
[18/18] docs_app_url (https://docs.nautobot.com/projects/my-app/en/latest):

Congratulations! Your cookie has now been baked. It is located at /opt/ntc/nautobot/cookiecutter-nautobot-app/outputs/nautobot-plugin-my-plugin.
Congratulations! Your cookie has now been baked. It is located at /opt/ntc/nautobot/cookiecutter-nautobot-app/outputs/nautobot-app-my-app.

⚠️⚠️ Before you start using your cookie you must run the following commands inside your cookie:

Expand Down Expand Up @@ -127,11 +127,11 @@ First create the `my-app.json` file:
"full_name": "Network to Code, LLC",
"email": "[email protected]",
"github_org": "nautobot",
"plugin_name": "my_app",
"app_name": "my_app",
"verbose_name": "My App",
"plugin_slug": "my-app",
"project_slug": "nautobot-plugin-my-app",
"repo_url": "https://github.com/nautobot/nautobot-plugin-my-app",
"app_slug": "my-app",
"project_slug": "nautobot-app-my-app",
"repo_url": "https://github.com/nautobot/nautobot-app-my-app",
"base_url": "my-app",
"min_nautobot_version": "2.0.0",
"max_nautobot_version": "2.9999",
Expand All @@ -156,7 +156,7 @@ Output:
```shell
docker compose run --rm -- dev cookiecutter --output-dir=./outputs --replay-file=my-app.json ./nautobot-app

Congratulations! Your cookie has now been baked. It is located at /opt/ntc/nautobot/cookiecutter-nautobot-app/outputs/nautobot-plugin-my-app.
Congratulations! Your cookie has now been baked. It is located at /opt/ntc/nautobot/cookiecutter-nautobot-app/outputs/nautobot-app-my-app.

⚠️⚠️ Before you start using your cookie you must run the following commands inside your cookie:

Expand Down
20 changes: 10 additions & 10 deletions 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.app_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 All @@ -32,24 +32,24 @@ The following table lists the inputs that you will be prompted for when generati

| Setting | Description |
|-------- | ----------- |
| **codeowner_github_usernames** | The Github codeowners for the new plugin |
| **full_name** | Used in the **author** field within `pyproject.toml` and `PluginConfig` |
| **codeowner_github_usernames** | The Github codeowners for the new app |
| **full_name** | Used in the **author** field within `pyproject.toml` and `NautobotAppConfig` |
| **email** | Used in the **author** field within `pyproject.toml` |
| **github_org** | Used to construct **repo_url** |
| **system_of_record** | The System of Record that the plug-in is intended to work with. |
| **system_of_record_slug** | Used to construct model and adapter names. |
| **system_of_record_camel** | Used to construct class names. |
| **plugin_name** | The Python name of the plugin |
| **verbose_name** | Used in `PluginConfig` |
| **plugin_slug** | Python packaging name |
| **app_name** | The Python name of the app |
| **verbose_name** | Used in `NautobotAppConfig` |
| **app_slug** | Python packaging name |
| **project_slug** | Used to construct **repo_url** |
| **base_url** | Defines plugin's base url used in Nautobot |
| **base_url** | Defines app's base url used in Nautobot |
| **min_nautobot_version** | The minimum supported Nautobot version |
| **max_nautobot_version** | The maximum supported Nautobot version |
| **nautobot_version** | Used for development purposes to decide with Nautobot-dev Docker image to use for development |
| **camel_name** | Used to define the plugin's subclassing of `PluginConfig`, e.g. `MyPluginConfig(PluginConfig):` |
| **project_short_description** | Used in the **description** field within `PluginConfig` |
| **camel_name** | Used to define the app's subclassing of `NautobotAppConfig`, e.g. `MyNautobotAppConfig(NautobotAppConfig):` |
| **project_short_description** | Used in the **description** field within `NautobotAppConfig` |
| **model_class_name** | If you want to generate initial files, such as `models.py`, `forms.py`, `filters.py`, `navigation.py`, `tables.py`, `views`, and API models, initialize this name to a valid model name. The default value is `None` |
| **Select open_source_license** | Determine if project is open source or not |
| **docs_base_url**| The main URL where the project documentation will be hosted. For open source projects use the default (`https://docs.nautobot.com`). |
| **docs_app_url**| The full URL for documentation hosting. You might want to shorten the project alias, for example `https://docs.nautobot.com/projects/ssot-system-of-record/en/latest` instead of `https://docs.nautobot.com/projects/nautobot-plugin-ssot-system-of-record/en/latest`. Make sure there's no trailing `/`! |
| **docs_app_url**| The full URL for documentation hosting. You might want to shorten the project alias, for example `https://docs.nautobot.com/projects/ssot-system-of-record/en/latest` instead of `https://docs.nautobot.com/projects/nautobot-app-ssot-system-of-record/en/latest`. Make sure there's no trailing `/`! |
10 changes: 5 additions & 5 deletions nautobot-app-ssot/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
"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('_', '-') }}",
"app_name": "nautobot_ssot_{{ cookiecutter.system_of_record.lower().replace(' ', '_').replace('-', '_') }}",
"verbose_name": "{{ cookiecutter.app_name.title().replace('_', ' ') }}",
"app_slug": "{{ cookiecutter.app_name.lower().replace(' ', '-').replace('_', '-') }}",
"project_slug": "nautobot-app-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('-', '') }}",
"camel_name": "{{ cookiecutter.app_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.app_slug }}/en/latest"
}
14 changes: 7 additions & 7 deletions nautobot-app-ssot/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ def cookies_baked_nautobot_app_ssot(cookies):
examples_projects = {}
results = {}
extra_contexts = {
"nautobot-plugin-ssot-ext-sor": {
"nautobot-app-ssot-ext-sor": {
"open_source_license": "Not open source",
"system_of_record": "Ext SoR",
},
"nautobot-plugin-ssot-my-sor": {
"nautobot-app-ssot-my-sor": {
"open_source_license": "Apache-2.0",
"system_of_record": "My SoR",
},
}
# pylint: disable-next=protected-access
environ["COOKIECUTTER_CONFIG"] = str(cookies._config_file)
for plugin_slug, extra_context in extra_contexts.items():
results[plugin_slug] = cookies.bake(extra_context=extra_context, template="nautobot-app-ssot")
for app_slug, extra_context in extra_contexts.items():
results[app_slug] = cookies.bake(extra_context=extra_context, template="nautobot-app-ssot")

assert results[plugin_slug].exception is None
assert results[app_slug].exception is None

examples_projects[plugin_slug] = init_examples_project(plugin_slug)
shutil.move(results[plugin_slug].project_path, examples_projects[plugin_slug])
examples_projects[app_slug] = init_examples_project(app_slug)
shutil.move(results[app_slug].project_path, examples_projects[app_slug])

return results, examples_projects
8 changes: 4 additions & 4 deletions nautobot-app-ssot/tests/test_bake_nautobot_app_ssot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_bake_nautobot_execution(cookies_baked_nautobot_app_ssot):
Tests creation of example nautobot with the cookiecutter default values
"""
results, examples_projects = cookies_baked_nautobot_app_ssot
plugin_slug = "nautobot-plugin-ssot-ext-sor"
assert results[plugin_slug].exit_code == 0
assert results[plugin_slug].exception is None
assert examples_projects[plugin_slug].is_dir()
app_slug = "nautobot-app-ssot-ext-sor"
assert results[app_slug].exit_code == 0
assert results[app_slug].exception is None
assert examples_projects[app_slug].is_dir()
14 changes: 7 additions & 7 deletions nautobot-app-ssot/{{ cookiecutter.project_slug }}/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# {{ cookiecutter.verbose_name }} SSoT

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

The term SSoT, or Single Source of Truth, refers to the intention of using Nautobot to consolidate data from disparate Systems of Record to create a single resource for all automation needs. This is done by extending the [Nautobot SSoT framework](https://github.com/nautobot/nautobot-plugin-ssot) which uses the DiffSync library. This plug-in is built with the capability in mind to import and export data from your desired System of Record.

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.app_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.app_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="https://pypi.org/project/{{ cookiecutter.app_slug }}/"><img src="https://img.shields.io/pypi/v/{{ cookiecutter.app_slug }}"></a>
<a href="https://pypi.org/project/{{ cookiecutter.app_slug }}/"><img src="https://img.shields.io/pypi/dm/{{ cookiecutter.app_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 @@ -33,9 +33,9 @@ To avoid extra work and temporary links, make sure that publishing docs (or merg

> 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.
> 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.
> 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/app-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 app's added functionality:

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

Expand Down
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.app_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.app_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 app 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 }}/).
Apps 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 app is [`{{ cookiecutter.app_slug }}`](https://pypi.org/project/{{ cookiecutter.app_slug }}/).

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

```shell
pip install {{ cookiecutter.plugin_slug }}
pip install {{ cookiecutter.app_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.app_slug }}` package:

```shell
echo {{ cookiecutter.plugin_slug }} >> local_requirements.txt
echo {{ cookiecutter.app_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:
Once installed, the app 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.app_name }}"` to the `PLUGINS` list.
- Append the `"{{ cookiecutter.app_name }}"` dictionary to the `PLUGINS_CONFIG` dictionary and override any defaults.

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

PLUGINS_CONFIG = {
"nautobot_ssot": {
"hide_example_jobs": True,
},
'{{ cookiecutter.plugin_name }}': {
'{{ cookiecutter.app_name }}': {
# ADD YOUR SETTINGS HERE
},
}
Expand All @@ -78,10 +78,10 @@ sudo systemctl restart nautobot nautobot-worker nautobot-scheduler
!!! 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:
The app 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. |
| `enable_backup` | `True` | `True` | A boolean to represent whether or not to run backup configurations within the app. |
| `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 |
Loading

0 comments on commit 3ca8aca

Please sign in to comment.