Skip to content

Commit

Permalink
supportbundle: fix nil pointer error (#2789)
Browse files Browse the repository at this point in the history
when iproute2 is not installed in docker image, and run `antctl supportbundle` in
antrea-agent, it will panic, this is because, collectAgent will return a nil pointer
for systemv1beta1.SupportBundle, and in `func (r *supportBundleREST) Create`,
antrea handles the nil pointer directly which leads to the panic.

Signed-off-by: Bin Liu <biliu@vmware.com>
  • Loading branch information
liu4480 committed Sep 16, 2021
1 parent 317f0ea commit 116d6db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/apiserver/registry/system/supportbundle/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ func (r *supportBundleREST) Create(ctx context.Context, obj runtime.Object, _ re
r.cache = b
}
}()
r.clean(ctx, b.Filepath, bundleExpireDuration)
if err != nil {
r.clean(ctx, b.Filepath, bundleExpireDuration)
}
}()

return r.cache, nil
Expand Down

0 comments on commit 116d6db

Please sign in to comment.