Merge pull request #7676 from markturansky/fix_nil_ptr

Fixed nil pointer issue in describe when volume is unbound
This commit is contained in:
Wojciech Tyczynski 2015-05-04 10:32:44 +02:00
commit 9581aa85e9

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, "Name:\t%s\n", pv.Name)
fmt.Fprintf(out, "Labels:\t%s\n", formatLabels(pv.Labels)) fmt.Fprintf(out, "Labels:\t%s\n", formatLabels(pv.Labels))
fmt.Fprintf(out, "Status:\t%d\n", pv.Status.Phase) 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 return nil
}) })
} }