Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
 - Set debug from ENV var as well
 - Only set sentinel if we are not on a dry-run so we can examine the
   DAG
 - Set the DAG with Init so tmpfs is part of it

Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Feb 14, 2023
1 parent 3ef3ac0 commit 220641d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions internal/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@ Sends a generic event payload with the configuration found in the scanned direct
debug := len(utils.ReadCMDLineArg("rd.immucore.debug")) > 0
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Logger()
zerolog.SetGlobalLevel(zerolog.InfoLevel)
if debug {
debugFromEnv := os.Getenv("IMMUCORE_DEBUG") != ""
if debug || debugFromEnv {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()
zerolog.SetGlobalLevel(zerolog.DebugLevel)
}

// First set the sentinel file
err = utils.SetSentinelFile()
if err != nil {
log.Logger.Err(err).Send()
return err
if !c.Bool("dry-run") {
err = utils.SetSentinelFile()
if err != nil {
log.Logger.Err(err).Send()
return err
}
}

// If we boot from CD, we do nothing
Expand All @@ -61,7 +64,7 @@ Sends a generic event payload with the configuration found in the scanned direct
}
}
log.Debug().Strs("TargetImage", img).Msg("Target image")
g := herd.DAG()
g := herd.DAG(herd.EnableInit)
s := &mount.State{
Logger: log.Logger,
Rootdir: utils.GetRootDir(),
Expand Down
1 change: 0 additions & 1 deletion pkg/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func (s *State) Register(g *herd.Graph) error {

// TODO: add hooks, fstab (might have missed some), systemd compat
// TODO: We should also set tmpfs here (not -related)

err = g.Add(opMountTmpfs, herd.WithCallback(s.MountOP("tmpfs", "/tmp", "tmpfs", []string{"rw"}, 10*time.Second)))
if err != nil {
s.Logger.Debug().Err(err).Msg("tmpfs mount")
Expand Down

0 comments on commit 220641d

Please sign in to comment.