Skip to content

Commit

Permalink
Fix small logging issues
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Hipp <[email protected]>
  • Loading branch information
monstermunchkin committed Nov 17, 2023
1 parent 2b957fb commit 1ee669b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion distrobuilder/main_incus.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (c *cmdIncus) runPack(cmd *cobra.Command, args []string, overlayDir string)
return fmt.Errorf("Failed to manage packages: %w", err)
}

c.global.logger.Info("Running hooks", "trigger", "post-packages")
c.global.logger.WithField("trigger", "post-packages").Info("Running hooks")

// Run post packages hook
for _, hook := range c.global.definition.GetRunnableActions("post-packages", imageTargets) {
Expand Down
11 changes: 7 additions & 4 deletions managers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type managerCommands struct {

// Manager represents a package manager.
type Manager struct {
mgr manager
def shared.Definition
ctx context.Context
mgr manager
def shared.Definition
ctx context.Context
logger *logrus.Logger
}

type manager interface {
Expand Down Expand Up @@ -90,7 +91,7 @@ func Load(ctx context.Context, managerName string, logger *logrus.Logger, defini
return nil, fmt.Errorf("Failed to load manager %q: %w", managerName, err)
}

return &Manager{def: definition, mgr: d, ctx: ctx}, nil
return &Manager{def: definition, mgr: d, ctx: ctx, logger: logger}, nil
}

// ManagePackages manages packages.
Expand Down Expand Up @@ -122,6 +123,8 @@ func (m *Manager) ManagePackages(imageTarget shared.ImageTarget) error {
return fmt.Errorf("Failed to update: %w", err)
}

m.logger.WithField("trigger", "post-update").Info("Running hooks")

// Run post update hook
for _, action := range m.def.GetRunnableActions("post-update", imageTarget) {
if action.Pongo {
Expand Down

0 comments on commit 1ee669b

Please sign in to comment.