Merge pull request #208 from Madhu-1/simplify

skip redundant error check
This commit is contained in:
Róbert Vašek 2019-02-18 20:45:54 +01:00 committed by GitHub
commit 8e41a8a7ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,11 +87,8 @@ func execCommand(program string, args ...string) (stdout, stderr []byte, err err
} }
func execCommandErr(program string, args ...string) error { func execCommandErr(program string, args ...string) error {
if _, _, err := execCommand(program, args...); err != nil { _, _, err := execCommand(program, args...)
return err return err
}
return nil
} }
func execCommandJSON(v interface{}, program string, args ...string) error { func execCommandJSON(v interface{}, program string, args ...string) error {
@ -119,10 +116,7 @@ func isMountPoint(p string) (bool, error) {
return !notMnt, nil return !notMnt, nil
} }
//
// Controller service request validation // Controller service request validation
//
func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error { func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error {
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil { if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
return fmt.Errorf("invalid CreateVolumeRequest: %v", err) return fmt.Errorf("invalid CreateVolumeRequest: %v", err)
@ -154,10 +148,7 @@ func (cs *ControllerServer) validateDeleteVolumeRequest() error {
return nil return nil
} }
//
// Node service request validation // Node service request validation
//
func validateNodeStageVolumeRequest(req *csi.NodeStageVolumeRequest) error { func validateNodeStageVolumeRequest(req *csi.NodeStageVolumeRequest) error {
if req.GetVolumeCapability() == nil { if req.GetVolumeCapability() == nil {
return errors.New("volume capability missing in request") return errors.New("volume capability missing in request")
@ -200,7 +191,7 @@ func validateNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) error {
} }
if req.GetTargetPath() == "" { if req.GetTargetPath() == "" {
return errors.New("varget path missing in request") return errors.New("target path missing in request")
} }
return nil return nil