Add script to generate per-user cookie file
The script is called gitzilla-gencookie
This commit is contained in:
parent
e6c1bc0b7f
commit
a8e59bdfbb
1
setup.py
1
setup.py
@ -21,6 +21,7 @@ args = dict(
|
||||
'console_scripts': [
|
||||
'gitzilla-post-receive = gitzilla.hookscripts:post_receive',
|
||||
'gitzilla-update = gitzilla.hookscripts:update',
|
||||
'gitzilla-gencookie = gitzilla.utilscripts:generate_cookiefile',
|
||||
],
|
||||
}
|
||||
)
|
||||
|
34
utilscripts.py
Normal file
34
utilscripts.py
Normal file
@ -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…
x
Reference in New Issue
Block a user