You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Shalom Bhooshi (JIRA)" <ji...@apache.org> on 2014/10/03 01:36:34 UTC

[jira] [Updated] (CLOUDSTACK-7670) Cloudmonkey should not force coloured output when not interactive

     [ https://issues.apache.org/jira/browse/CLOUDSTACK-7670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalom Bhooshi updated CLOUDSTACK-7670:
---------------------------------------
    Summary: Cloudmonkey should not force coloured output when not interactive  (was: Cloudmonkey should not forced coloured output when not interactive)

> Cloudmonkey should not force coloured output when not interactive
> -----------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7670
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7670
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Cloudmonkey
>         Environment: # cloudmonkey --version
> cloudmonkey 5.2.0
>            Reporter: Shalom Bhooshi
>
> Consider the output here from cloudmonkey here
> {code}
> cloudmonkey list zones 
> 404 Client Error: Not Found
> {code}
> One would expect to be able to pipe this output to another util to parse it
> {code}
> # cloudmonkey list zones | grep 'Client Error'; echo $?                                                                      
> 1
> {code}
> However, that does not match due to there being the non-printable ANSI codes to colour the output around the word ''Error''
> {code}
> # cloudmonkey list zones | cat -et
> ^[[34;01m404^[[39;49;00m^[[39;49;00m ^[[39;49;00m^[[39;49;00mClient^[[39;49;00m^[[39;49;00m ^[[39;49;00m^[[31;01mError^[[39;49;00m^[[39;49;00m:^[[39;49;00m^[[39;49;00m ^[[39;49;00m^[[39;49;00mNot^[[39;49;00m^[[39;49;00m ^[[39;49;00m^[[39;49;00mFound^[[39;49;00m$
> # cloudmonkey list zones | grep 'Client.*Error'; echo $?                                                                     
> 404 Client Error: Not Found
> 0
> {code}
> Cloudmonkey ought to test if the output is interactive and only display in colour if it is through something like so
> {code}
> if sys.flags.interactive:
>     #interactive, colours are ok
> else:
>     #not interactive, colours are not ok.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)