Skip to content

Commit

Permalink
Fixes #12
Browse files Browse the repository at this point in the history
- Add check and error message when no firewall configuration is found.
  • Loading branch information
rodvand committed May 27, 2020
1 parent 7918f80 commit d3365bd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions netbox_paloalto/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@ def get(self, request, name=None):
import pandevice.objects

fw_configs = FirewallConfig.objects.all()

if len(fw_configs) == 0:
error = "No firewall configs found"
error_heading = "Unable to find any firewall configurations"
error_body = (
"Make sure you have defined any firewalls/Panorama connections in the admin site."
)

return render(
request,
"netbox_paloalto/rules.html",
{
"name": name,
"error": error,
"error_heading": error_heading,
"error_body": error_body,
},
)

output = []

for fw in fw_configs:
Expand Down

0 comments on commit d3365bd

Please sign in to comment.