Skip to content

Commit

Permalink
Merge pull request #735 from zaneb/vsphere-invalid-configuration
Browse files Browse the repository at this point in the history
vSphere: Enter Failed phase on invalid configuration
  • Loading branch information
openshift-merge-robot committed Oct 23, 2020
2 parents c1f0af9 + a516365 commit b50263f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/vsphere/machine_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func newMachineScope(params machineScopeParams) (*machineScope, error) {

user, password, err := getCredentialsSecret(params.client, params.machine.GetNamespace(), *providerSpec)
if err != nil {
return nil, fmt.Errorf("%v: error getting credentials: %v", params.machine.GetName(), err)
return nil, fmt.Errorf("%v: error getting credentials: %w", params.machine.GetName(), err)
}
if providerSpec.Workspace == nil {
return nil, fmt.Errorf("%v: no workspace provided", params.machine.GetName())
Expand Down Expand Up @@ -182,7 +182,7 @@ func getCredentialsSecret(client runtimeclient.Client, namespace string, spec ap
&credentialsSecret); err != nil {

if apimachineryerrors.IsNotFound(err) {
machineapierros.InvalidMachineConfiguration("credentials secret %v/%v not found: %v", namespace, spec.CredentialsSecret.Name, err.Error())
return "", "", machineapierros.InvalidMachineConfiguration("credentials secret %v/%v not found: %v", namespace, spec.CredentialsSecret.Name, err.Error())
}
return "", "", fmt.Errorf("error getting credentials secret %v/%v: %v", namespace, spec.CredentialsSecret.Name, err)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/vsphere/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func newReconciler(scope *machineScope) *Reconciler {
// create creates machine if it does not exists.
func (r *Reconciler) create() error {
if err := validateMachine(*r.machine); err != nil {
return fmt.Errorf("%v: failed validating machine provider spec: %v", r.machine.GetName(), err)
return fmt.Errorf("%v: failed validating machine provider spec: %w", r.machine.GetName(), err)
}

// We only clone the VM template if we have no taskRef.
Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *Reconciler) create() error {
// update finds a vm and reconciles the machine resource status against it.
func (r *Reconciler) update() error {
if err := validateMachine(*r.machine); err != nil {
return fmt.Errorf("%v: failed validating machine provider spec: %v", r.machine.GetName(), err)
return fmt.Errorf("%v: failed validating machine provider spec: %w", r.machine.GetName(), err)
}

if r.providerStatus.TaskRef != "" {
Expand Down Expand Up @@ -166,7 +166,7 @@ func (r *Reconciler) update() error {
// exists returns true if machine exists.
func (r *Reconciler) exists() (bool, error) {
if err := validateMachine(*r.machine); err != nil {
return false, fmt.Errorf("%v: failed validating machine provider spec: %v", r.machine.GetName(), err)
return false, fmt.Errorf("%v: failed validating machine provider spec: %w", r.machine.GetName(), err)
}

if _, err := findVM(r.machineScope); err != nil {
Expand Down Expand Up @@ -241,7 +241,7 @@ func (r *Reconciler) delete() error {
Namespace: r.machine.Namespace,
Reason: err.Error(),
})
return fmt.Errorf("%v: failed to destroy vm: %v", r.machine.GetName(), err)
return fmt.Errorf("%v: failed to destroy vm: %w", r.machine.GetName(), err)
}

if err := setProviderStatus(task.Reference().Value, conditionSuccess(), r.machineScope, vm); err != nil {
Expand Down

0 comments on commit b50263f

Please sign in to comment.