From 73ec099fa1dfb6fbf3cb49e4ee4c729e1f496106 Mon Sep 17 00:00:00 2001 From: Paul Mars Date: Wed, 18 Oct 2023 12:34:22 +0200 Subject: [PATCH] Move setArtifactNames stateFunc since it is now used by 2 different build --- internal/statemachine/common_states.go | 10 ++++++++++ internal/statemachine/snap_states.go | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/statemachine/common_states.go b/internal/statemachine/common_states.go index 09f09c7f..f167bea7 100644 --- a/internal/statemachine/common_states.go +++ b/internal/statemachine/common_states.go @@ -68,6 +68,16 @@ func (stateMachine *StateMachine) determineOutputDirectory() error { return nil } +// for snap/core image builds, the image name is always .img for +// each volume in the gadget. This function stores that info in the struct +func (stateMachine *StateMachine) setArtifactNames() error { + stateMachine.VolumeNames = make(map[string]string) + for volumeName := range stateMachine.GadgetInfo.Volumes { + stateMachine.VolumeNames[volumeName] = volumeName + ".img" + } + return nil +} + // Load gadget.yaml, do some validation, and store the relevant info in the StateMachine struct func (stateMachine *StateMachine) loadGadgetYaml() error { gadgetYamlDst := filepath.Join(stateMachine.stateMachineFlags.WorkDir, "gadget.yaml") diff --git a/internal/statemachine/snap_states.go b/internal/statemachine/snap_states.go index 7c92d84d..8faf5efb 100644 --- a/internal/statemachine/snap_states.go +++ b/internal/statemachine/snap_states.go @@ -82,16 +82,6 @@ func (stateMachine *StateMachine) prepareImage() error { return nil } -// for snap/core image builds, the image name is always .img for -// each volume in the gadget. This function stores that info in the struct -func (stateMachine *StateMachine) setArtifactNames() error { - stateMachine.VolumeNames = make(map[string]string) - for volumeName := range stateMachine.GadgetInfo.Volumes { - stateMachine.VolumeNames[volumeName] = volumeName + ".img" - } - return nil -} - // populateSnapRootfsContents uses a NewMountedFileSystemWriter to populate the rootfs func (stateMachine *StateMachine) populateSnapRootfsContents() error { var src, dst string