From f4e8aaf865585b981bad9d7a9bb01e9101e04c8e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:59:00 +0000 Subject: [PATCH 1/5] [skip ci] Updated CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1242dfb..72ffe60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [Unreleased](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/tree/HEAD) + +[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/compare/v0.0.2...HEAD) + +**Merged pull requests:** + +- Prepare for public release [\#5](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/pull/5) ([abhi1693](https://github.com/abhi1693)) + ## [v0.0.2](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/tree/v0.0.2) (2023-01-22) [Full Changelog](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/compare/v0.0.1...v0.0.2) From 05bba63bc3ccc994ab893a3b7eff012726924174 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 24 Jan 2023 01:10:21 +0530 Subject: [PATCH 2/5] added python-publish.yml --- .github/workflows/python-publish.yml | 40 ++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..b1ed529 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,40 @@ +--- +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/setup.py b/setup.py index 6f347f3..73aa2a8 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='netbox-metatype-importer', - version='0.0.2', + version='0.0.3', description='Import Metatypes', long_description='Import MetaTypes into NetBox', long_description_content_type="text/markdown", From 6480e5618c7a0330a7a6130437a46a7ce6f7b70e Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 24 Jan 2023 01:15:45 +0530 Subject: [PATCH 3/5] updated README.md #7 --- README.md | 53 ++++++++++++++++------------ netbox_metatype_importer/__init__.py | 4 +-- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index c4a33c0..07d069a 100644 --- a/README.md +++ b/README.md @@ -5,32 +5,39 @@ The plugin uses [GitHub GraphQL API](https://docs.github.com/en/graphql) to load DeviceType from [NetBox Device Type Library](https://github.com/netbox-community/devicetype-library). The plugin loads only file tree representation from GitHub repo and shows it as a table with vendor and model columns. DeviceType definitions files are loaded when you try to import selected models. To use GraphQL API you need to set GitHub personal access token in plugin settings. How to create the token, see ["Creating a personal access token."](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) -## Compatibility +# Compatibility -This plugin in compatible with [NetBox](https://netbox.readthedocs.org/) 3.0 and later +| NetBox Version | Plugin Version | +|:----------------:|:--------------:| +| 3.4.x | 0.0.x | -## Installation +# Installation -The plugin is available as a Python package in pypi and can be installed with pip - -``` -pip install git+https://github.com/Onemind-Services-LLC/netbox-metatype-importer.git -``` -Enable the plugin in [NetBox Configuration](https://netbox.readthedocs.io/en/stable/configuration/) -``` -PLUGINS = ['netbox_metatype_importer'] -``` +* Install NetBox as per NetBox documentation +* Add to local_requirements.txt: + * `netbox-metatype-importer` +* Install requirements: `./venv/bin/pip install -r local_requirements.txt` +* Add to PLUGINS in NetBox configuration: + * `'netbox_metatype_importer',` +* Run migration: `./venv/bin/python netbox/manage.py migrate` ## Configuration -Put your GitHub personal access token to [NetBox plugins config](https://netbox.readthedocs.io/en/stable/configuration/optional-settings/#plugins_config) -``` -PLUGINS_CONFIG = { - 'netbox_metatype_importer': { - 'github_token': '' - } -} -``` - -## Future -* Import device images from GitHub repo +The following options are available in the configuration file: + +- `branch` + - __Type__: `String` + - __Description__: Branch of the NetBox Device Type Library repo + - __Default__: `master` +- `github_token` + - __Type__: `String` + - __Description__: GitHub personal access token + - __Default__: `None` +- `repo` + - __Type__: `String` + - __Description__: Name of the NetBox Device Type Library repo + - __Default__: `devicetype-library` +- `repo_owner` + - __Type__: `String` + - __Description__: Owner of the NetBox Device Type Library repo + - __Default__: `netbox-community` diff --git a/netbox_metatype_importer/__init__.py b/netbox_metatype_importer/__init__.py index b8dfbca..ca900ef 100644 --- a/netbox_metatype_importer/__init__.py +++ b/netbox_metatype_importer/__init__.py @@ -18,9 +18,9 @@ class NetBoxMetatypeImporterConfig(PluginConfig): 'repo_owner': 'netbox-community', 'repo': 'devicetype-library', 'branch': 'master', - 'github_token': '', - 'use_gql': True, + 'github_token': '' } + required_settings = ['github_token'] config = NetBoxMetatypeImporterConfig From cf5a08bfebc5928447c68f40770f756970b4b1c9 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 24 Jan 2023 01:17:50 +0530 Subject: [PATCH 4/5] fixed plugins.py --- configuration/plugins.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configuration/plugins.py b/configuration/plugins.py index 2a4fc90..a5363f0 100644 --- a/configuration/plugins.py +++ b/configuration/plugins.py @@ -9,5 +9,7 @@ ] PLUGINS_CONFIG = { # type: ignore - "netbox_metatype_importer": {}, + "netbox_metatype_importer": { + 'github_token': 'YOUR_GITHUB_TOKEN' + }, } From 2f583283bcbd5a79081639ef0d3bf8883b2543cb Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 24 Jan 2023 01:18:22 +0530 Subject: [PATCH 5/5] updated README.md #7 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3948364..7fbeee6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ The following options are available in the configuration file: - `github_token` - __Type__: `String` - __Description__: GitHub personal access token - - __Default__: `None` - `repo` - __Type__: `String` - __Description__: Name of the NetBox Device Type Library repo