Add script to generate per-user cookie file
The script is called gitzilla-gencookiemaster
parent
e6c1bc0b7f
commit
a8e59bdfbb
1
setup.py
1
setup.py
|
@ -21,6 +21,7 @@ args = dict(
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'gitzilla-post-receive = gitzilla.hookscripts:post_receive',
|
'gitzilla-post-receive = gitzilla.hookscripts:post_receive',
|
||||||
'gitzilla-update = gitzilla.hookscripts:update',
|
'gitzilla-update = gitzilla.hookscripts:update',
|
||||||
|
'gitzilla-gencookie = gitzilla.utilscripts:generate_cookiefile',
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
"""
|
||||||
|
utilscripts - utility scripts for gitzilla.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import bugz.bugzilla
|
||||||
|
import getpass
|
||||||
|
|
||||||
|
def generate_cookiefile():
|
||||||
|
"""
|
||||||
|
asks the user for Bugzilla credentials and generates a cookiefile.
|
||||||
|
"""
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print """Usage:
|
||||||
|
%s <bugzilla_base_url>
|
||||||
|
""" % sys.argv[0]
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
sBZUrl = sys.argv[1]
|
||||||
|
sLogin = os.getlogin()
|
||||||
|
sUsername = raw_input("username [%s]: " % (sLogin,))
|
||||||
|
sPassword = getpass.getpass("password: ")
|
||||||
|
|
||||||
|
if sUsername == "":
|
||||||
|
sUsername = sLogin
|
||||||
|
|
||||||
|
oBZ = bugz.bugzilla.Bugz(sBZUrl, user=sUsername, password=sPassword)
|
||||||
|
oBZ.auth()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue