mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 14:21:18 +00:00
Merge pull request #362 from skriss/tweak-hook-logging
during backup, only log if hooks are actually executing
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user