mirror of
https://github.com/kairos-io/immucore.git
synced 2025-09-15 14:41:08 +00:00
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:
@@ -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
|
debug := len(utils.ReadCMDLineArg("rd.immucore.debug")) > 0
|
||||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Logger()
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Logger()
|
||||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
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()
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()
|
||||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// First set the sentinel file
|
// First set the sentinel file
|
||||||
err = utils.SetSentinelFile()
|
if !c.Bool("dry-run") {
|
||||||
if err != nil {
|
err = utils.SetSentinelFile()
|
||||||
log.Logger.Err(err).Send()
|
if err != nil {
|
||||||
return err
|
log.Logger.Err(err).Send()
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we boot from CD, we do nothing
|
// 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")
|
log.Debug().Strs("TargetImage", img).Msg("Target image")
|
||||||
g := herd.DAG()
|
g := herd.DAG(herd.EnableInit)
|
||||||
s := &mount.State{
|
s := &mount.State{
|
||||||
Logger: log.Logger,
|
Logger: log.Logger,
|
||||||
Rootdir: utils.GetRootDir(),
|
Rootdir: utils.GetRootDir(),
|
||||||
|
@@ -192,7 +192,6 @@ func (s *State) Register(g *herd.Graph) error {
|
|||||||
|
|
||||||
// TODO: add hooks, fstab (might have missed some), systemd compat
|
// TODO: add hooks, fstab (might have missed some), systemd compat
|
||||||
// TODO: We should also set tmpfs here (not -related)
|
// 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)))
|
err = g.Add(opMountTmpfs, herd.WithCallback(s.MountOP("tmpfs", "/tmp", "tmpfs", []string{"rw"}, 10*time.Second)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Logger.Debug().Err(err).Msg("tmpfs mount")
|
s.Logger.Debug().Err(err).Msg("tmpfs mount")
|
||||||
|
Reference in New Issue
Block a user