Skip to content

Commit

Permalink
Use log instead of fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vannrt committed Aug 11, 2018
1 parent 335b552 commit 87e9bca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ func isUpgradeRequired(old *spv1.MachineComponentVersions, cur *spv1.MachineComp
}

func upgradeMachine(ip string) {
fmt.Printf("Upgrading machine %s\n", ip)
log.Printf("Upgrading machine %s\n", ip)

oldMachine, err := state.ClusterClient.ClusterV1alpha1().
Machines(common.DefaultNamespace).
Expand All @@ -670,7 +670,7 @@ func upgradeMachine(ip string) {
upgradeRequired, upgrade := isUpgradeRequired(oldMachineSpec.ComponentVersions, currentComponentVersions)

if !upgradeRequired {
fmt.Printf("Machine is up to date\n")
log.Println("Machine is up to date.")
return
}

Expand All @@ -684,15 +684,15 @@ func upgradeMachine(ip string) {
// and create a new one with the same specs as the old one
createMachine(ip, oldProvisionedMachine.Spec.SSHConfig.Port, oldProvisionedMachine.Spec.VIPNetworkInterface,
role, oldProvisionedMachine.Spec.SSHConfig.PublicKeys)
fmt.Println("Machine upgraded successfully.")
log.Println("Machine upgraded successfully.")
return
}

// A nodeadm/etcdadm version change does not require an actuator call, just a state file update
if upgrade.NodeadmVersion || upgrade.EtcdadmVersion {
oldMachineSpec.ComponentVersions.NodeadmVersion = currentComponentVersions.NodeadmVersion
oldMachineSpec.ComponentVersions.EtcdadmVersion = currentComponentVersions.EtcdadmVersion
fmt.Println("Nodeadm/Etcdadm only change, updating state file")
log.Println("Nodeadm/Etcdadm only change, updating state file.")

if err := sputil.PutMachineSpec(*oldMachineSpec, oldMachine); err != nil {
log.Fatalf("unable to encode machine provider spec: %v", err)
Expand All @@ -704,7 +704,7 @@ func upgradeMachine(ip string) {
if err := state.PullFromAPIs(); err != nil {
log.Fatalf("Unable to sync on-disk state: %v", err)
}
fmt.Println("Machine upgraded successfully.")
log.Println("Machine upgraded successfully.")
return
}
}
Expand Down

0 comments on commit 87e9bca

Please sign in to comment.