Browse code

Idle command: make sure to always print errors

There was a print of an error message missing in the `oc idle` command
(it printed out that there was an error, but didn't tell you what the
error was). This fixes that.

Solly Ross authored on 2016/08/27 04:59:22
Showing 1 changed files
... ...
@@ -548,7 +548,7 @@ func (o *IdleOptions) RunIdle(f *clientcmd.Factory) error {
548 548
 	for scaleRef, svcName := range byScalable {
549 549
 		obj, scale, err := scaleAnnotater.GetObjectWithScale(svcName.Namespace, scaleRef)
550 550
 		if err != nil {
551
-			fmt.Fprintf(o.errOut, "error: unable to get scale for %s %s/%s, not marking that scalable as idled\n", scaleRef.Kind, svcName.Namespace, scaleRef.Name)
551
+			fmt.Fprintf(o.errOut, "error: unable to get scale for %s %s/%s, not marking that scalable as idled: %v\n", scaleRef.Kind, svcName.Namespace, scaleRef.Name, err)
552 552
 			svcInfo := byService[svcName]
553 553
 			delete(svcInfo.scaleRefs, scaleRef)
554 554
 			hadError = true
... ...
@@ -625,7 +625,7 @@ func (o *IdleOptions) RunIdle(f *clientcmd.Factory) error {
625 625
 		if !o.dryRun {
626 626
 			info.scale.Spec.Replicas = 0
627 627
 			if err := scaleAnnotater.UpdateObjectScale(info.namespace, scaleRef, info.obj, info.scale); err != nil {
628
-				fmt.Fprintf(o.errOut, "error: unable to scale %s %s/%s to 0, but still listed as target for unidling\n", scaleRef.Kind, info.namespace, scaleRef.Name)
628
+				fmt.Fprintf(o.errOut, "error: unable to scale %s %s/%s to 0, but still listed as target for unidling: %v\n", scaleRef.Kind, info.namespace, scaleRef.Name, err)
629 629
 				hadError = true
630 630
 				continue
631 631
 			}