Skip to content

Commit

Permalink
Merge pull request #12 from gardener/provider-check
Browse files Browse the repository at this point in the history
Updated the error codes
  • Loading branch information
MartinWeindel authored Apr 14, 2021
2 parents e056245 + b4aa7ff commit a65a158
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/vsphere/machine_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func (ms *MachinePlugin) CreateMachine(ctx context.Context, req *driver.CreateMa

// check if the machineClass is of the supported provider
if req.MachineClass.Provider != Providervsphere {
return nil, fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
err := fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
return nil, status.Error(codes.InvalidArgument, err.Error())
}

providerSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)
Expand Down Expand Up @@ -110,7 +111,8 @@ func (ms *MachinePlugin) DeleteMachine(ctx context.Context, req *driver.DeleteMa

// check if the machineClass is of the supported provider
if req.MachineClass.Provider != Providervsphere {
return nil, fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
err := fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
return nil, status.Error(codes.InvalidArgument, err.Error())
}

providerSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)
Expand Down Expand Up @@ -150,7 +152,8 @@ func (ms *MachinePlugin) GetMachineStatus(ctx context.Context, req *driver.GetMa

// check if the machineClass is of the supported provider
if req.MachineClass.Provider != Providervsphere {
return nil, fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
err := fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
return nil, status.Error(codes.InvalidArgument, err.Error())
}

providerSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)
Expand Down Expand Up @@ -192,7 +195,8 @@ func (ms *MachinePlugin) ListMachines(ctx context.Context, req *driver.ListMachi

// check if the machineClass is of the supported provider
if req.MachineClass.Provider != Providervsphere {
return nil, fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
err := fmt.Errorf("Requested provider is '%s'. We support only '%s'", req.MachineClass.Provider, Providervsphere)
return nil, status.Error(codes.InvalidArgument, err.Error())
}

providerSpec, err := decodeProviderSpecAndSecret(req.MachineClass, req.Secret)
Expand Down

0 comments on commit a65a158

Please sign in to comment.