[PATCH] Added -q option to koji moshimoshi for suppressing output

Mike McLean mikem at redhat.com
Wed May 7 18:09:47 UTC 2014


On 05/05/2014 10:57 AM, riehecky at fnal.gov wrote:
> From: Pat Riehecky <riehecky at fnal.gov>

Could you explain the use case here?

> ---
>  cli/koji |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/cli/koji b/cli/koji
> index 088c505..2dd3dcb 100755
> --- a/cli/koji
> +++ b/cli/koji
> @@ -6138,20 +6138,22 @@ def handle_moshimoshi(options, session, args):
>      "Introduce yourself"
>      usage = _("usage: %prog moshimoshi [options]")
>      parser = OptionParser(usage=usage)
> +    parser.add_option("-q", action="store_true", help=_("only print unsuccessful connections"))
>      (options, args) = parser.parse_args(args)
>      if len(args) != 0:
>          parser.error(_("This command takes no arguments"))
>          assert False
>      activate_session(session)
>      u = session.getLoggedInUser()
> -    if not u:
> -        print "Not authenticated"
> -        u = {'name' : 'anonymous user'}
> -    print "%s, %s!" % (random.choice(greetings), u["name"],)
> -    print ""
> -    print "You are using the hub at %s" % (session.baseurl,)
> -    if u.get("krb_principal", None) is not None:
> -        print "Authenticated via Kerberos principal %s" % (u["krb_principal"])
> +    if not parser.q:
> +        if not u:
> +            print "Not authenticated"
> +            u = {'name' : 'anonymous user'}
> +        print "%s, %s!" % (random.choice(greetings), u["name"],)
> +        print ""
> +        print "You are using the hub at %s" % (session.baseurl,)
> +        if u.get("krb_principal", None) is not None:
> +            print "Authenticated via Kerberos principal %s" % (u["krb_principal"])
>  
>  def handle_help(options, session, args):
>      "List available commands"
> 



More information about the buildsys mailing list