Skip to content

Commit

Permalink
Fix dereference of optional deletion policy field (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhav Kamra authored and mergify[bot] committed Nov 7, 2019
1 parent d80360a commit bc128b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/kube/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func CreateFromSource(ctx context.Context, snapCli snapshotclient.Interface, sou
Name: snapshotName,
},
VolumeSnapshotClassName: source.VolumeSnapshotClassName,
DeletionPolicy: &deletionPolicy,
DeletionPolicy: deletionPolicy,
},
}
snap := &snapshot.VolumeSnapshot{
Expand Down Expand Up @@ -239,10 +239,10 @@ func getContent(ctx context.Context, snapCli snapshotclient.Interface, contentNa
return snapCli.VolumesnapshotV1alpha1().VolumeSnapshotContents().Get(contentName, metav1.GetOptions{})
}

func getDeletionPolicyFromClass(snapCli snapshotclient.Interface, snapClassName string) (snapshot.DeletionPolicy, error) {
func getDeletionPolicyFromClass(snapCli snapshotclient.Interface, snapClassName string) (*snapshot.DeletionPolicy, error) {
vsc, err := snapCli.VolumesnapshotV1alpha1().VolumeSnapshotClasses().Get(snapClassName, metav1.GetOptions{})
if err != nil {
return "", errors.Wrapf(err, "Failed to find VolumeSnapshotClass: %s", snapClassName)
return nil, errors.Wrapf(err, "Failed to find VolumeSnapshotClass: %s", snapClassName)
}
return *vsc.DeletionPolicy, nil
return vsc.DeletionPolicy, nil
}

0 comments on commit bc128b1

Please sign in to comment.