From ade62d2f14686204a3a278724629adc75fd48856 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Thu, 5 Oct 2023 10:49:40 -0600 Subject: [PATCH] Update cli flag name and description: We were asking for an IP but showing a URL. Signed-off-by: Jacob Weinstock --- README.md | 4 ++-- cmd/smee/flag.go | 4 ++-- cmd/smee/flag_test.go | 8 ++++---- cmd/smee/main.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d8ab1068..d005d458 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,8 @@ FLAGS -backend-kube-namespace [backend] an optional Kubernetes namespace override to query hardware data from, kube backend only -dhcp-addr [dhcp] local IP and port to listen on for DHCP requests (default "0.0.0.0:67") -dhcp-enabled [dhcp] enable DHCP server (default "true") - -dhcp-http-ipxe-binary-ip [dhcp] http ipxe binary server IP address to use in DHCP packets (default "http://172.17.0.2:8080/ipxe/") - -dhcp-http-ipxe-script-url [dhcp] http ipxe script server URL to use in DHCP packets (default "http://172.17.0.2/auto.ipxe") + -dhcp-http-ipxe-binary-url [dhcp] HTTP ipxe binaries URL to use in DHCP packets (default "http://172.17.0.2:8080/ipxe/") + -dhcp-http-ipxe-script-url [dhcp] HTTP ipxe script URL to use in DHCP packets (default "http://172.17.0.2/auto.ipxe") -dhcp-ip-for-packet [dhcp] ip address to use in DHCP packets (opt 54, etc) (default "172.17.0.2") -dhcp-syslog-ip [dhcp] syslog server IP address to use in DHCP packets (opt 7) (default "172.17.0.2") -dhcp-tftp-ip [dhcp] tftp server IP address to use in DHCP packets (opt 66, etc) (default "172.17.0.2:69") diff --git a/cmd/smee/flag.go b/cmd/smee/flag.go index 1842a44a..47dcae85 100644 --- a/cmd/smee/flag.go +++ b/cmd/smee/flag.go @@ -110,8 +110,8 @@ func dhcpFlags(c *config, fs *flag.FlagSet) { fs.StringVar(&c.dhcp.ipForPacket, "dhcp-ip-for-packet", detectPublicIPv4(""), "[dhcp] IP address to use in DHCP packets (opt 54, etc)") fs.StringVar(&c.dhcp.syslogIP, "dhcp-syslog-ip", detectPublicIPv4(""), "[dhcp] syslog server IP address to use in DHCP packets (opt 7)") fs.StringVar(&c.dhcp.tftpIP, "dhcp-tftp-ip", detectPublicIPv4(":69"), "[dhcp] tftp server IP address to use in DHCP packets (opt 66, etc)") - fs.StringVar(&c.dhcp.httpIpxeBinaryIP, "dhcp-http-ipxe-binary-ip", "http://"+detectPublicIPv4(":8080/ipxe/"), "[dhcp] HTTP ipxe binary server IP address to use in DHCP packets") - fs.StringVar(&c.dhcp.httpIpxeScriptURL, "dhcp-http-ipxe-script-url", "http://"+detectPublicIPv4("/auto.ipxe"), "[dhcp] HTTP ipxe script server URL to use in DHCP packets") + fs.StringVar(&c.dhcp.httpIpxeBinaryURL, "dhcp-http-ipxe-binary-url", "http://"+detectPublicIPv4(":8080/ipxe/"), "[dhcp] HTTP ipxe binaries URL to use in DHCP packets") + fs.StringVar(&c.dhcp.httpIpxeScriptURL, "dhcp-http-ipxe-script-url", "http://"+detectPublicIPv4("/auto.ipxe"), "[dhcp] HTTP ipxe script URL to use in DHCP packets") } func backendFlags(c *config, fs *flag.FlagSet) { diff --git a/cmd/smee/flag_test.go b/cmd/smee/flag_test.go index e78bd8da..4f16444d 100644 --- a/cmd/smee/flag_test.go +++ b/cmd/smee/flag_test.go @@ -33,7 +33,7 @@ func TestParser(t *testing.T) { ipForPacket: "192.168.2.4", syslogIP: "192.168.2.4", tftpIP: "192.168.2.4:69", - httpIpxeBinaryIP: "http://192.168.2.4:8080/ipxe/", + httpIpxeBinaryURL: "http://192.168.2.4:8080/ipxe/", httpIpxeScriptURL: "http://192.168.2.4/auto.ipxe", }, logLevel: "info", @@ -52,7 +52,7 @@ func TestParser(t *testing.T) { "-dhcp-ip-for-packet", "192.168.2.4", "-dhcp-syslog-ip", "192.168.2.4", "-dhcp-tftp-ip", "192.168.2.4:69", - "-dhcp-http-ipxe-binary-ip", "http://192.168.2.4:8080/ipxe/", + "-dhcp-http-ipxe-binary-url", "http://192.168.2.4:8080/ipxe/", "-dhcp-http-ipxe-script-url", "http://192.168.2.4/auto.ipxe", } cli := newCLI(&got, fs) @@ -86,8 +86,8 @@ FLAGS -backend-kube-namespace [backend] an optional Kubernetes namespace override to query hardware data from, kube backend only -dhcp-addr [dhcp] local IP:Port to listen on for DHCP requests (default "0.0.0.0:67") -dhcp-enabled [dhcp] enable DHCP server (default "true") - -dhcp-http-ipxe-binary-ip [dhcp] HTTP ipxe binary server IP address to use in DHCP packets (default "http://%[1]v:8080/ipxe/") - -dhcp-http-ipxe-script-url [dhcp] HTTP ipxe script server URL to use in DHCP packets (default "http://%[1]v/auto.ipxe") + -dhcp-http-ipxe-binary-url [dhcp] HTTP ipxe binaries URL to use in DHCP packets (default "http://%[1]v:8080/ipxe/") + -dhcp-http-ipxe-script-url [dhcp] HTTP ipxe script URL to use in DHCP packets (default "http://%[1]v/auto.ipxe") -dhcp-ip-for-packet [dhcp] IP address to use in DHCP packets (opt 54, etc) (default "%[1]v") -dhcp-syslog-ip [dhcp] syslog server IP address to use in DHCP packets (opt 7) (default "%[1]v") -dhcp-tftp-ip [dhcp] tftp server IP address to use in DHCP packets (opt 66, etc) (default "%[1]v:69") diff --git a/cmd/smee/main.go b/cmd/smee/main.go index a5e6fdc6..64b670d2 100644 --- a/cmd/smee/main.go +++ b/cmd/smee/main.go @@ -85,7 +85,7 @@ type dhcpConfig struct { ipForPacket string syslogIP string tftpIP string - httpIpxeBinaryIP string + httpIpxeBinaryURL string httpIpxeScriptURL string } @@ -249,7 +249,7 @@ func (c *config) dhcpHandler(ctx context.Context, log logr.Logger) (*reservation if err != nil { return nil, fmt.Errorf("invalid tftp address for DHCP server: %w", err) } - httpBinaryURL, err := url.Parse(c.dhcp.httpIpxeBinaryIP) + httpBinaryURL, err := url.Parse(c.dhcp.httpIpxeBinaryURL) if err != nil || httpBinaryURL == nil { return nil, fmt.Errorf("invalid http ipxe binary url: %w", err) }