Bug 961105

Summary: rhc app show --gears does not align columns correctly for idle or stopped states
Product: OpenShift Online Reporter: Justin Harris <jharris>
Component: ocAssignee: Justin Harris <jharris>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: ccoleman, jinzhang, jkeck, wsun
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-11 04:02:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Justin Harris 2013-05-08 19:44:01 UTC
Description of problem:
Tabular output from "rhc app show <name> --gears" is misaligned if the state is not "started"  


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.  Create a scaling app
2.  Add one or more additional cartridges
3.  Idle (or stop) one or more gears
4.  run "rhc app show <name> --gears"
  
Actual results:
Here is example output:
ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- -----------------------------------------------------------------------------------------
518a7a80e627270b2f000002         idle php-5.3 haproxy-1.4 small 518a7a80e627270b2f000002.rhcloud.com
379e958eb7fb11e2bcc912313d0836f7 idle mongodb-2.2         small 379e958eb7fb11e2bcc912313d0836f7.rhcloud.com
518a9376e627270b2f000003         stopped mysql-5.1           small 518a9376e627270b2f000003.rhcloud.com


Expected results:
The state output should be padded correctly:

ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- -----------------------------------------------------------------------------------------
518a7a80e627270b2f000002         idle    php-5.3 haproxy-1.4 small 518a7a80e627270b2f000002.rhcloud.com
379e958eb7fb11e2bcc912313d0836f7 idle    mongodb-2.2         small 379e958eb7fb11e2bcc912313d0836f7.rhcloud.com
518a9376e627270b2f000003         stopped mysql-5.1           small 518a9376e627270b2f000003.rhcloud.com


Additional info:
I suspect that the coloring is affecting the padding calculation.

Comment 1 Clayton Coleman 2013-05-19 00:07:04 UTC
String format can't handle ansi sequences, which means it puts in the wrong padding. 

Fixed in https://github.com/openshift/rhc/pull/387

Comment 2 joycezhang 2013-05-20 06:15:35 UTC
Verified this bug with rhc-1.9.2 built from devenv_3246, the column are aligned correcly when showing with stopped or idled gears as below
# rhc app show -a app7 --gears
ID                               State   Cartridges            Size  SSH URL
-------------------------------- ------- --------------------- ----- -------------------------------------------------------------------------
f506cd36c10f11e2a39622000a8d9cd5 started perl-5.10 haproxy-1.4 small f506cd36c10f11e2a39622000a8d9cd5.rhcloud.com
5199ba43d814ae0a76000009         stopped postgresql-8.4        small 5199ba43d814ae0a76000009.rhcloud.com
5199ba8fd814ae0a7600000a         idle    mysql-5.1             small 5199ba8fd814ae0a7600000a.rhcloud.com