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

Pat Riehecky riehecky at fnal.gov
Wed May 7 18:23:51 UTC 2014


Upon further reflection, I can get what I need out of other options.  
Basically I was just checking to make sure I could authenticate to koji 
from a non-UTF8 environment.

In reality, it seems I've got some easier options, don't bother merging 
this...

Pat

On 05/07/2014 01:09 PM, Mike McLean wrote:
> 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"
>>
> --
> buildsys mailing list
> buildsys at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/buildsys


-- 
Pat Riehecky

Scientific Linux developer
http://www.scientificlinux.org/



More information about the buildsys mailing list