Skip to content

Commit

Permalink
Move setArtifactNames stateFunc since it is now used by 2 different b…
Browse files Browse the repository at this point in the history
…uild
  • Loading branch information
upils committed Oct 18, 2023
1 parent 9815ea4 commit 73ec099
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 10 additions & 0 deletions internal/statemachine/common_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ func (stateMachine *StateMachine) determineOutputDirectory() error {
return nil
}

// for snap/core image builds, the image name is always <volume-name>.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")
Expand Down
10 changes: 0 additions & 10 deletions internal/statemachine/snap_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ func (stateMachine *StateMachine) prepareImage() error {
return nil
}

// for snap/core image builds, the image name is always <volume-name>.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
Expand Down

0 comments on commit 73ec099

Please sign in to comment.