Skip to content

Commit

Permalink
Use lowercase for local variable (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenkacz authored and kensipe committed Jun 28, 2019
1 parent a30c5fb commit 34ffdb1
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions pkg/kudoctl/cmd/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ func installOperator(operatorArgument string, isDependencyInstall bool, reposito
// Operator part

// Check if Operator exists
OperatorName := crds.Operator.ObjectMeta.Name
operatorName := crds.Operator.ObjectMeta.Name
if !kc.OperatorExistsInCluster(crds.Operator.ObjectMeta.Name, options.Namespace) {
if err := installSingleOperatorToCluster(OperatorName, options.Namespace, crds.Operator, kc); err != nil {
if err := installSingleOperatorToCluster(operatorName, options.Namespace, crds.Operator, kc); err != nil {
return errors.Wrap(err, "installing single Operator")
}
}
Expand All @@ -139,26 +139,26 @@ func installOperator(operatorArgument string, isDependencyInstall bool, reposito
// Check if AnyOperatorVersion for Operator exists
if !kc.AnyOperatorVersionExistsInCluster(crds.Operator.ObjectMeta.Name, options.Namespace) {
// OperatorVersion CRD for Operator does not exist
if err := installSingleOperatorVersionToCluster(OperatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator: %s", OperatorName)
if err := installSingleOperatorVersionToCluster(operatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator: %s", operatorName)
}
}

// Check if OperatorVersion is out of sync with official OperatorVersion for this Operator
if !kc.OperatorVersionInClusterOutOfSync(OperatorName, crds.OperatorVersion.Spec.Version, options.Namespace) {
if !kc.OperatorVersionInClusterOutOfSync(operatorName, crds.OperatorVersion.Spec.Version, options.Namespace) {
// This happens when the given OperatorVersion is not existing. E.g.
// when a version has been installed that is not part of the official kudobuilder/operators repo.
if !options.AutoApprove {
fmt.Printf("No official OperatorVersion has been found for \"%s\". "+
"Do you want to install one? (Yes/no) ", OperatorName)
"Do you want to install one? (Yes/no) ", operatorName)
if helpers.AskForConfirmation() {
if err := installSingleOperatorVersionToCluster(OperatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator %s", OperatorName)
if err := installSingleOperatorVersionToCluster(operatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator %s", operatorName)
}
}
} else {
if err := installSingleOperatorVersionToCluster(OperatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator %s", OperatorName)
if err := installSingleOperatorVersionToCluster(operatorName, options.Namespace, kc, crds.OperatorVersion); err != nil {
return errors.Wrapf(err, "installing OperatorVersion CRD for operator %s", operatorName)
}
}

Expand Down Expand Up @@ -198,7 +198,7 @@ func installOperator(operatorArgument string, isDependencyInstall bool, reposito
// Check if Instance exists in cluster
// It won't create the Instance if any in combination with given Operator Name, OperatorVersion and Instance OperatorName exists
instanceName := crds.Instance.ObjectMeta.Name
instanceExists, err := kc.InstanceExistsInCluster(OperatorName, options.Namespace, crds.OperatorVersion.Spec.Version, instanceName)
instanceExists, err := kc.InstanceExistsInCluster(operatorName, options.Namespace, crds.OperatorVersion.Spec.Version, instanceName)
if err != nil {
return errors.Wrapf(err, "verifying the instance does not already exist")
}
Expand All @@ -208,23 +208,23 @@ func installOperator(operatorArgument string, isDependencyInstall bool, reposito
// when a version has been installed that is not part of the official kudobuilder/operators repo.
if !options.AutoApprove {
fmt.Printf("No Instance tied to this \"%s\" version has been found. "+
"Do you want to create one? (Yes/no) ", OperatorName)
"Do you want to create one? (Yes/no) ", operatorName)
if helpers.AskForConfirmation() {
// If Instance is a dependency we need to make sure installSingleInstanceToCluster is aware of it.
// By having the previous string set we can make this distinction.
if err := installSingleInstanceToCluster(OperatorName, crds.Instance, kc, options); err != nil {
if err := installSingleInstanceToCluster(operatorName, crds.Instance, kc, options); err != nil {
return errors.Wrap(err, "installing single Instance")
}
}
} else {
if err := installSingleInstanceToCluster(OperatorName, crds.Instance, kc, options); err != nil {
if err := installSingleInstanceToCluster(operatorName, crds.Instance, kc, options); err != nil {
return errors.Wrap(err, "installing single Instance")
}
}

} else {
return fmt.Errorf("can not install Instance %s of operator %s-%s because instance of that name already exists in namespace %s",
instanceName, OperatorName, crds.OperatorVersion.Spec.Version, options.Namespace)
instanceName, operatorName, crds.OperatorVersion.Spec.Version, options.Namespace)
}
return nil
}
Expand Down

0 comments on commit 34ffdb1

Please sign in to comment.