mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 22:05:25 +00:00
Prevent nil panic on exec restore hooks (#5675)
* Prevent nil panic on exec restore hooks Signed-off-by: Dylan Murray <dymurray@redhat.com>
This commit is contained in:
1
changelogs/unreleased/5675-dymurray
Normal file
1
changelogs/unreleased/5675-dymurray
Normal file
@@ -0,0 +1 @@
|
||||
Prevent nil panic on exec restore hooks
|
||||
@@ -342,10 +342,12 @@ func (c *restoreController) validateAndComplete(restore *api.Restore, pluginMana
|
||||
}
|
||||
for _, resource := range restoreHooks {
|
||||
for _, h := range resource.RestoreHooks {
|
||||
for _, container := range h.Init.InitContainers {
|
||||
err = hook.ValidateContainer(container.Raw)
|
||||
if err != nil {
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, err.Error())
|
||||
if h.Init != nil {
|
||||
for _, container := range h.Init.InitContainers {
|
||||
err = hook.ValidateContainer(container.Raw)
|
||||
if err != nil {
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user