Skip to content

Commit

Permalink
Reworked configuration.py handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Reimann, Timo committed Sep 29, 2021
1 parent cea87ad commit 24d8133
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 26 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Restart NetBox and add `netbox-cisco-support` to your `local_requirements.txt`
Sync Cisco EoX data for the first time
```
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
(venv) $ python3 manage.py sync_eox_data
````

## Configuration
The following options are available:
Expand Down
2 changes: 1 addition & 1 deletion netbox_cisco_support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CiscoSupportConfig(PluginConfig):
author_email = 'timo@goebelmeier.de'
base_url = 'cisco-support'
min_version = '3.0.3'
required_settings = []
required_settings = ['cisco_client_id', 'cisco_client_secret']
default_settings = {
'device_ext_page': 'right'
}
Expand Down
7 changes: 5 additions & 2 deletions netbox_cisco_support/management/commands/sync_eox_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from develop.configuration import CISCO_CLIENT_ID, CISCO_CLIENT_SECRET
from pprint import pprint
import requests
import json
import django.utils.text

from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from datetime import datetime
from requests import api
Expand Down Expand Up @@ -269,6 +268,10 @@ def get_serial_numbers(self, manufacturer):
return serial_numbers

def logon(self):
PLUGIN_SETTINGS = settings.PLUGINS_CONFIG.get("netbox_cisco_support", dict())
CISCO_CLIENT_ID = PLUGIN_SETTINGS.get("cisco_client_id", "")
CISCO_CLIENT_SECRET = PLUGIN_SETTINGS.get("cisco_client_secret", "")

token_url = "https://cloudsso.cisco.com/as/token.oauth2"
data = {'grant_type': 'client_credentials', 'client_id': CISCO_CLIENT_ID, 'client_secret': CISCO_CLIENT_SECRET}

Expand Down
9 changes: 0 additions & 9 deletions netbox_cisco_support/navigation.py

This file was deleted.

12 changes: 0 additions & 12 deletions netbox_cisco_support/urls.py

This file was deleted.

2 changes: 1 addition & 1 deletion netbox_cisco_support/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1"
__version__ = "0.4"

0 comments on commit 24d8133

Please sign in to comment.