Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: move and inline LogStart() further up #380

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package debos
import (
"bytes"
"github.com/go-debos/fakemachine"
"log"
obbardc marked this conversation as resolved.
Show resolved Hide resolved
)

type DebosState int
Expand Down Expand Up @@ -75,10 +74,6 @@ type BaseAction struct {
Description string
}

func (b *BaseAction) LogStart() {
obbardc marked this conversation as resolved.
Show resolved Hide resolved
log.Printf("==== %s ====\n", b)
}

func (b *BaseAction) Verify(context *DebosContext) error { return nil }
func (b *BaseAction) PreMachine(context *DebosContext,
m *fakemachine.Machine,
Expand Down
2 changes: 0 additions & 2 deletions actions/apt_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func NewAptAction() *AptAction {
}

func (apt *AptAction) Run(context *debos.DebosContext) error {
evelikov marked this conversation as resolved.
Show resolved Hide resolved
apt.LogStart()

aptConfig := []string{}

/* Don't show progress update percentages */
Expand Down
1 change: 0 additions & 1 deletion actions/debootstrap_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ func (d *DebootstrapAction) isLikelyOldSuite() bool {
}

func (d *DebootstrapAction) Run(context *debos.DebosContext) error {
d.LogStart()
cmdline := []string{"debootstrap"}

if d.MergedUsr {
Expand Down
1 change: 0 additions & 1 deletion actions/download_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func (d *DownloadAction) Verify(context *debos.DebosContext) error {

func (d *DownloadAction) Run(context *debos.DebosContext) error {
var filename string
d.LogStart()

url, err := d.validateUrl()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion actions/filesystem_deploy_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func (fd *FilesystemDeployAction) setupKernelCmdline(context *debos.DebosContext
}

func (fd *FilesystemDeployAction) Run(context *debos.DebosContext) error {
fd.LogStart()
/* Copying files is actually silly hafd, one has to keep permissions, ACL's
* extended attribute, misc, other. Leave it to cp...
*/
Expand Down
2 changes: 0 additions & 2 deletions actions/image_partition_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,6 @@ func (i *ImagePartitionAction) PreNoMachine(context *debos.DebosContext) error {
}

func (i ImagePartitionAction) Run(context *debos.DebosContext) error {
i.LogStart()

/* On certain disk device events udev will call the BLKRRPART ioctl to
* re-read the partition table. This will cause the partition devices
* (e.g. vda3) to temporarily disappear while the rescanning happens.
Expand Down
1 change: 0 additions & 1 deletion actions/ostree_commit_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func emptyDir(dir string) {
}

func (ot *OstreeCommitAction) Run(context *debos.DebosContext) error {
ot.LogStart()
repoPath := path.Join(context.Artifactdir, ot.Repository)

emptyDir(path.Join(context.Rootdir, "dev"))
Expand Down
2 changes: 0 additions & 2 deletions actions/ostree_deploy_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ func (ot *OstreeDeployAction) setupFSTab(deployment *ostree.Deployment, context
}

func (ot *OstreeDeployAction) Run(context *debos.DebosContext) error {
ot.LogStart()

// This is to handle cases there we didn't partition an image
if len(context.ImageMntDir) != 0 {
/* First deploy the current rootdir to the image so it can seed e.g.
Expand Down
1 change: 0 additions & 1 deletion actions/overlay_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func (overlay *OverlayAction) Verify(context *debos.DebosContext) error {
}

func (overlay *OverlayAction) Run(context *debos.DebosContext) error {
overlay.LogStart()
origin := context.RecipeDir

//Trying to get a filename from exports first
Expand Down
1 change: 0 additions & 1 deletion actions/pack_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func (pf *PackAction) Verify(context *debos.DebosContext) error {
}

func (pf *PackAction) Run(context *debos.DebosContext) error {
pf.LogStart()
usePigz := false
if pf.Compression == "gz" {
if _,err := exec.LookPath("pigz"); err == nil {
Expand Down
2 changes: 0 additions & 2 deletions actions/pacman_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ type PacmanAction struct {
}

func (p *PacmanAction) Run(context *debos.DebosContext) error {
p.LogStart()

pacmanOptions := []string{"pacman", "-Syu", "--noconfirm"}
pacmanOptions = append(pacmanOptions, p.Packages...)

Expand Down
2 changes: 0 additions & 2 deletions actions/pacstrap_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ func (d *PacstrapAction) PreMachine(context *debos.DebosContext, m *fakemachine.
}

func (d *PacstrapAction) Run(context *debos.DebosContext) error {
d.LogStart()

files := map[string]string{
"/etc/pacman.conf": d.Config,
"/etc/pacman.d/mirrorlist": d.Mirror,
Expand Down
1 change: 0 additions & 1 deletion actions/raw_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (raw *RawAction) Verify(context *debos.DebosContext) error {
}

func (raw *RawAction) Run(context *debos.DebosContext) error {
raw.LogStart()
origin, found := context.Origin(raw.Origin)
if !found {
return fmt.Errorf("Origin `%s` doesn't exist\n", raw.Origin)
Expand Down
4 changes: 2 additions & 2 deletions actions/recipe_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ package actions
import (
"errors"
"fmt"
"log"
"os"
"path/filepath"
"github.com/go-debos/debos"
Expand Down Expand Up @@ -114,9 +115,8 @@ func (recipe *RecipeAction) PreNoMachine(context *debos.DebosContext) error {
}

func (recipe *RecipeAction) Run(context *debos.DebosContext) error {
recipe.LogStart()

for _, a := range recipe.Actions.Actions {
log.Printf("==== %s ====\n", a)
if err := a.Run(&recipe.context); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion actions/run_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (run *RunAction) PreMachine(context *debos.DebosContext, m *fakemachine.Mac
}

func (run *RunAction) doRun(context debos.DebosContext) error {
run.LogStart()
var cmdline []string
var label string
var cmd debos.Command
Expand Down
1 change: 0 additions & 1 deletion actions/unpack_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (pf *UnpackAction) Verify(context *debos.DebosContext) error {
}

func (pf *UnpackAction) Run(context *debos.DebosContext) error {
pf.LogStart()
var origin string

if len(pf.Origin) > 0 {
Expand Down
1 change: 1 addition & 0 deletions cmd/debos/debos.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func checkError(context *debos.DebosContext, err error, a debos.Action, stage st

func do_run(r actions.Recipe, context *debos.DebosContext) int {
for _, a := range r.Actions {
log.Printf("==== %s ====\n", a)
evelikov marked this conversation as resolved.
Show resolved Hide resolved
err := a.Run(context)

// This does not stop the call of stacked Cleanup methods for other Actions
Expand Down