Skip to content
This repository was archived by the owner on Nov 17, 2021. It is now read-only.

Commit 116777e

Browse files
committed
prevent empty names in diff
1 parent 2b6e5b0 commit 116777e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/kubecfg/diff.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ func (c DiffCmd) Run(apiObjects []*unstructured.Unstructured, out io.Writer) err
6767
return err
6868
}
6969

70+
if obj.GetName() == "" {
71+
return fmt.Errorf("Error fetching one of the %s: it does not have a name set", utils.ResourceNameFor(c.Mapper, obj))
72+
}
73+
7074
liveObj, err := client.Get(obj.GetName(), metav1.GetOptions{})
7175
if err != nil && errors.IsNotFound(err) {
7276
log.Debugf("%s doesn't exist on the server", desc)

0 commit comments

Comments
 (0)