Skip to content

Commit

Permalink
Fix last linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Sep 19, 2023
1 parent 361d529 commit 1945b45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/statemachine/classic_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ func (stateMachine *StateMachine) preseedClassicImage() error {
// assemble the commands in the correct order: mount, preseed, unmount
preseedCmds = append(preseedCmds, mountCmds...)
preseedCmds = append(preseedCmds,
//nolint:gosec,G204
exec.Command("/usr/lib/snapd/snap-preseed", stateMachine.tempDirs.chroot),
)
preseedCmds = append(preseedCmds, umountCmds...)
Expand Down
10 changes: 9 additions & 1 deletion internal/statemachine/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,15 @@ func (stateMachine *StateMachine) updateGrub(rootfsVolName string, rootfsPartNum
"--detach",
loopUsed,
)
defer teardownCmd.Run()
defer func() {
if tmpErr := teardownCmd.Run(); tmpErr != nil {
if err != nil {
err = fmt.Errorf("%s after previous error: %w", tmpErr, err)
} else {
err = tmpErr
}
}
}()
updateGrubCmds = append(updateGrubCmds, teardownCmd)

// now run all the commands
Expand Down

0 comments on commit 1945b45

Please sign in to comment.