diff --git a/salt_observer/cherry.py b/salt_observer/cherry.py index 1e0f5fe6123a8e554f27697a90e33038b33ede28..0c6e7b79707236f3b08fb983d99df50f75fb3fd8 100644 --- a/salt_observer/cherry.py +++ b/salt_observer/cherry.py @@ -1,10 +1,12 @@ +from django.conf import settings + import requests from getpass import getpass class SaltCherrypyApi(object): - BASE_URL = 'http://localhost:8989' + BASE_URL = '{protocol}://{host}:{port}'.format(**settings.SALT_API) def __init__(self, username, password): ''' Log in every time an instance is created ''' diff --git a/salt_observer/private_settings.example.py b/salt_observer/private_settings.example.py index 77a56732724d5da1a2e48106c64c675517ed71cd..183b256c0229d1dc5e38b70c1f65680fde65a37c 100644 --- a/salt_observer/private_settings.example.py +++ b/salt_observer/private_settings.example.py @@ -22,3 +22,14 @@ DATABASES = { 'NAME': os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'db.sqlite3'), } } + + +# Salt observer configuration +SALT_API = { + 'host': 'localhost', + 'port': 8989, + 'protocol': 'http', +} + +# specify your salt network here to disable it in network visualization +SALT_NETWORK = '123.456.789.0' diff --git a/salt_observer/views.py b/salt_observer/views.py index 52aef54a8a4460d31b949d8147f8803e47825904..bd12a00c49acf87d9f2134e1f42ceb89888f8037 100644 --- a/salt_observer/views.py +++ b/salt_observer/views.py @@ -85,7 +85,7 @@ class VisualNetwork(TemplateView): ctx = super().get_context_data(*args, **kwargs) ctx.update({ 'minions': Minion.objects.all(), - 'networks': Network.objects.all().exclude(ipv4='10.1.10.0'), + 'networks': Network.objects.all().exclude(ipv4=settings.SALT_NETWORK), }) return ctx