Improvements

- 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 <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-02-14 13:48:57 +01:00
parent 3ef3ac0251
commit 220641df60
2 changed files with 9 additions and 7 deletions

View File

@@ -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
@@ -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(),