Merge pull request #11987 from markturansky/recyc_fix

Fixed newRecycler func for HostPath & NFS
This commit is contained in:
Mike Danese
2015-07-29 13:11:08 -07:00
2 changed files with 11 additions and 18 deletions

View File

@@ -86,11 +86,10 @@ func (plugin *hostPathPlugin) NewRecycler(spec *volume.Spec) (volume.Recycler, e
}
func newRecycler(spec *volume.Spec, host volume.VolumeHost) (volume.Recycler, error) {
if spec.VolumeSource.HostPath != nil {
return &hostPathRecycler{spec.Name, spec.VolumeSource.HostPath.Path, host}, nil
} else {
return &hostPathRecycler{spec.Name, spec.PersistentVolumeSource.HostPath.Path, host}, nil
if spec.PersistentVolumeSource.HostPath == nil {
return nil, fmt.Errorf("spec.PersistentVolumeSource.HostPath is nil")
}
return &hostPathRecycler{spec.Name, spec.PersistentVolumeSource.HostPath.Path, host}, nil
}
// HostPath volumes represent a bare host file or directory mount.