summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-08-05 15:06:36 -0400
committerWill Woods <wwoods@redhat.com>2008-08-05 15:06:36 -0400
commit2f5579929fe21479831b378a1dc5f0b561c346c0 (patch)
tree6dd5adcdf97c27dd685162764bcfd27ef64b792f /bin
parentc4508eafd17be977fcddab229ae1f80c7a47f0d4 (diff)
downloadpython-bugzilla-2f5579929fe21479831b378a1dc5f0b561c346c0.tar.gz
python-bugzilla-2f5579929fe21479831b378a1dc5f0b561c346c0.tar.xz
python-bugzilla-2f5579929fe21479831b378a1dc5f0b561c346c0.zip
Add login command and python-bugzilla-specific cookie file. Based on a patch by Zack Cerza.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bugzilla19
1 files changed, 15 insertions, 4 deletions
diff --git a/bin/bugzilla b/bin/bugzilla
index 7643c31..9623187 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -13,6 +13,7 @@
import bugzilla, optparse
import os, sys, glob, re
import logging
+import getpass
version = '0.3'
default_bz = 'https://bugzilla.redhat.com/xmlrpc.cgi'
@@ -25,7 +26,7 @@ if '--debug' in sys.argv:
elif '--verbose' in sys.argv:
log.setLevel(logging.INFO)
-cmdlist = ('info','query','new','modify')
+cmdlist = ('info','query','new','modify','login')
def setup_parser():
u = "usage: %prog [global options] COMMAND [options]"
u += "\nCommands: %s" % ', '.join(cmdlist)
@@ -189,15 +190,25 @@ if __name__ == '__main__':
# Connect to bugzilla
log.info('Connecting to %s',global_opt.bugzilla)
bz=bugzilla.Bugzilla(url=global_opt.bugzilla)
- if global_opt.user and global_opt.password:
+ if global_opt.user:
+ if not global_opt.password:
+ global_opt.password = getpass.getpass()
log.info('Using username/password for authentication')
bz.login(global_opt.user,global_opt.password)
else:
- log.info('No authentication info found.')
+ if global_opt.cookiefile:
+ bz.cookiefile = global_opt.cookiefile
+ cookiefile = bz.cookiefile
+ if os.path.exists(cookiefile):
+ log.info('Using cookies in %s for authentication', cookiefile)
+ else:
+ log.info('No authentication info found.')
# And now we actually execute the given command
buglist = list() # save the results of query/new/modify here
- if action == 'info':
+ if action == 'login':
+ pass
+ elif action == 'info':
if opt.products:
for k in sorted(bz.products):
print k