Skip to content

Commit

Permalink
Merge pull request #1 from ITJamie/v0.4
Browse files Browse the repository at this point in the history
V0.4.1
  • Loading branch information
ITJamie authored Apr 12, 2022
2 parents 817902c + a758117 commit 07f36ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 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.3"
version = "0.4.1"
base_url = "nb_gateways"


Expand Down
25 changes: 17 additions & 8 deletions netbox_gateways/template_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,26 @@ def x_page(self):
prefix__net_contains_or_equals=str(obj.address.ip),
status="active", # Only search for "active" prefixes
).prefetch_related("site", "role")
prefix = related_prefixs[
len(related_prefixs) - 1
] # get last prefix in the recordset above
if len(related_prefixs) >= 1:
try:
prefix = related_prefixs[
len(related_prefixs) - 1
] # get last prefix in the recordset above
except Prefix.ValueError:
prefix = None
else:
prefix = None
else:
prefix = gateways_obj.prefix

if not gateways_obj:
try:
gateways_obj = Gateway.objects.get(prefix=prefix)
except:
gateways_obj = None
if not prefix:
gateways_obj = None
else:
if not gateways_obj:
try:
gateways_obj = Gateway.objects.get(prefix=prefix)
except Gateway.DoesNotExist:
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.3",
version="0.4.1",
description="Manage simple prefix default gateways",
install_requires=[],
packages=find_packages(),
Expand Down

0 comments on commit 07f36ff

Please sign in to comment.