Fixed nil pointer issue in describe when volume is unbound

This commit is contained in:
markturansky 2015-05-02 06:49:19 -04:00
parent b447dc0c54
commit 2f5907b504

View File

@ -303,8 +303,11 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string) (string, er
fmt.Fprintf(out, "Name:\t%s\n", pv.Name)
fmt.Fprintf(out, "Labels:\t%s\n", formatLabels(pv.Labels))
fmt.Fprintf(out, "Status:\t%d\n", pv.Status.Phase)
fmt.Fprintf(out, "Claim:\t%d\n", pv.Spec.ClaimRef.UID)
if pv.Spec.ClaimRef != nil {
fmt.Fprintf(out, "Claim:\t%d\n", pv.Spec.ClaimRef.Namespace+"/"+pv.Spec.ClaimRef.Name)
} else {
fmt.Fprintf(out, "Claim:\t%d\n", "")
}
return nil
})
}