From 93307aab46d84ca00ba4f3d0180973ef22396304 Mon Sep 17 00:00:00 2001 From: pauhull <22707808+phm07@users.noreply.github.com> Date: Fri, 19 Apr 2024 12:31:14 +0200 Subject: [PATCH] fix(firewall): missing error when not setting port for tcp rule --- internal/cmd/firewall/add_rule.go | 5 ++--- internal/cmd/firewall/delete_rule.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/cmd/firewall/add_rule.go b/internal/cmd/firewall/add_rule.go index ac5648fd..54d1ec12 100644 --- a/internal/cmd/firewall/add_rule.go +++ b/internal/cmd/firewall/add_rule.go @@ -71,10 +71,9 @@ var AddRuleCmd = base.Cmd{ } switch rule.Protocol { - case hcloud.FirewallRuleProtocolTCP: - case hcloud.FirewallRuleProtocolUDP: + case hcloud.FirewallRuleProtocolUDP, hcloud.FirewallRuleProtocolTCP: if port == "" { - return fmt.Errorf("port is required") + return fmt.Errorf("port is required (--port)") } default: if port != "" { diff --git a/internal/cmd/firewall/delete_rule.go b/internal/cmd/firewall/delete_rule.go index cf16a3b4..fd98dc20 100644 --- a/internal/cmd/firewall/delete_rule.go +++ b/internal/cmd/firewall/delete_rule.go @@ -70,10 +70,9 @@ var DeleteRuleCmd = base.Cmd{ } switch rule.Protocol { - case hcloud.FirewallRuleProtocolTCP: - case hcloud.FirewallRuleProtocolUDP: + case hcloud.FirewallRuleProtocolTCP, hcloud.FirewallRuleProtocolUDP: if port == "" { - return fmt.Errorf("port is required") + return fmt.Errorf("port is required (--port)") } default: if port != "" {