From 78fc8631cadd3c1bc6c3015dedc7e396dc2fc231 Mon Sep 17 00:00:00 2001 From: Uzair Ali <72073401+uzaxirr@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:09:32 +0530 Subject: [PATCH] Check for No FW rules found --- cmd/firewall/firewall_rule_list.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/firewall/firewall_rule_list.go b/cmd/firewall/firewall_rule_list.go index 26cfe4c7..5d2c1bec 100644 --- a/cmd/firewall/firewall_rule_list.go +++ b/cmd/firewall/firewall_rule_list.go @@ -51,6 +51,11 @@ If you wish to use a custom format, the available fields are: os.Exit(1) } + if len(firewallRules) == 0 { + utility.Info("%s firewall has no rules, to create rules use command civo firewall rule create, for example:\ncivo firewall rule create test-issue -c '0.0.0.0/0' -s 443 -e 443 -l HTTPS", firewall.Name) + os.Exit(1) + } + ow := utility.NewOutputWriter() for _, firewallRule := range firewallRules { ow.StartLine()