From 1f31dd9ee4bf59c2e41e8cc627d9ff4e5ef0149d Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Tue, 26 Nov 2024 20:05:02 -0700 Subject: [PATCH] Fix linting issues Signed-off-by: Jacob Weinstock --- api/v1beta1/tinkerbellmachine_types.go | 8 +++++--- controller/machine/workflow.go | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/v1beta1/tinkerbellmachine_types.go b/api/v1beta1/tinkerbellmachine_types.go index 2afac01..256f549 100644 --- a/api/v1beta1/tinkerbellmachine_types.go +++ b/api/v1beta1/tinkerbellmachine_types.go @@ -88,11 +88,13 @@ type BootOptions struct { // When this field is set, the controller will create a job.bmc.tinkerbell.org object // for getting the associated hardware into a CDROM booting state. // A HardwareRef that contains a spec.BmcRef must be provided. + // // The format of the ISOURL must be http://$IP:$Port/iso/:macAddress/hook.iso // The name of the ISO file must have the .iso extension, but the name can be anything. - // The $IP and $Port should generally point to the IP and Port of the Smee server as this is where - // the ISO patching endpoint lives. - // The ":macAddress" is a placeholder for the MAC address of the hardware and should be provided exactly as is: ":macAddress". + // The $IP and $Port should generally point to the IP and Port of the Smee server + // as this is where the ISO patching endpoint lives. + // The ":macAddress" is a placeholder for the MAC address of the hardware and + // should be provided exactly as is: ":macAddress". // +optional // +kubebuilder:validation:Format=url ISOURL string `json:"isoURL,omitempty"` diff --git a/controller/machine/workflow.go b/controller/machine/workflow.go index 8604a4b..a3f8a10 100644 --- a/controller/machine/workflow.go +++ b/controller/machine/workflow.go @@ -77,13 +77,14 @@ func (scope *machineReconcileScope) createWorkflow(hw *tinkv1.Hardware) error { return errISOBootURLRequired } - workflow.Spec.BootOptions.BootMode = tinkv1.BootMode("iso") u, err := url.Parse(scope.tinkerbellMachine.Spec.BootOptions.ISOURL) if err != nil { return fmt.Errorf("boot option isoURL is not parse-able: %w", err) } + u.Path = strings.Replace(u.Path, ":macAddress", strings.Replace(hw.Spec.Metadata.Instance.ID, ":", "-", 5), 1) workflow.Spec.BootOptions.ISOURL = u.String() + workflow.Spec.BootOptions.BootMode = tinkv1.BootMode("iso") } }