Merge pull request #362 from skriss/tweak-hook-logging

during backup, only log if hooks are actually executing
This commit is contained in:
Andy Goldstein
2018-03-07 13:37:03 -05:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -165,7 +165,7 @@ func (ib *defaultItemBackupper) backupItem(logger logrus.FieldLogger, obj runtim
// Never save status
delete(obj.UnstructuredContent(), "status")
log.Info("Executing pre hooks")
log.Debug("Executing pre hooks")
if err := ib.itemHookHandler.handleHooks(log, groupResource, obj, ib.resourceHooks, hookPhasePre); err != nil {
return err
}
@@ -233,7 +233,7 @@ func (ib *defaultItemBackupper) backupItem(logger logrus.FieldLogger, obj runtim
}
}
log.Info("Executing post hooks")
log.Debug("Executing post hooks")
if err := ib.itemHookHandler.handleHooks(log, groupResource, obj, ib.resourceHooks, hookPhasePost); err != nil {
return err
}

View File

@@ -90,6 +90,7 @@ func (h *defaultItemHookHandler) handleHooks(
logrus.Fields{
"hookSource": "annotation",
"hookType": "exec",
"hookPhase": phase,
},
)
if err := h.podCommandExecutor.executePodCommand(hookLog, obj.UnstructuredContent(), namespace, name, "<from-annotation>", hookFromAnnotations); err != nil {
@@ -122,6 +123,7 @@ func (h *defaultItemHookHandler) handleHooks(
logrus.Fields{
"hookSource": "backupSpec",
"hookType": "exec",
"hookPhase": phase,
},
)
err := h.podCommandExecutor.executePodCommand(hookLog, obj.UnstructuredContent(), namespace, name, resourceHook.name, hook.Exec)