Skip to content

Commit

Permalink
failback if gateway doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ITJamie committed Apr 11, 2022
1 parent 66d5539 commit 817902c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion netbox_gateways/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NetBoxGatewayConfig(PluginConfig):
name = "netbox_gateways"
verbose_name = " Netbox Gateway"
description = "Manage simple prefix default gateways"
version = "0.2"
version = "0.3"
base_url = "nb_gateways"


Expand Down
5 changes: 4 additions & 1 deletion netbox_gateways/template_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def x_page(self):
prefix = gateways_obj.prefix

if not gateways_obj:
gateways_obj = Gateway.objects.get(prefix=prefix)
try:
gateways_obj = Gateway.objects.get(prefix=prefix)
except:
gateways_obj = None

return self.render(
"netbox_gateways/ip_card.html",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="netbox-gateways",
version="0.2",
version="0.3",
description="Manage simple prefix default gateways",
install_requires=[],
packages=find_packages(),
Expand Down

0 comments on commit 817902c

Please sign in to comment.