From beb4b618e51187d85aecc7c3cbfd4848f5770ad0 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 19 Aug 2010 07:51:14 -0500 Subject: pull the username from fedora_cert to pass to bodhi --- src/fedpkg.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fedpkg.py b/src/fedpkg.py index 2d01681..0a60b64 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -692,16 +692,23 @@ def update(args): # Suggest that users restart after update suggest_reboot=False\ """ - args = {'nvr': nvr, 'bugs': ''} + if not args.user: + try: + args.user = fedora_cert.read_user_cert() + except: + log.debug('Could not read Fedora cert, using login name') + args.user = os.getlogin() + + bodhi_args = {'nvr': nvr, 'bugs': ''} # Extract bug numbers from the latest changelog entry mymodule.clog() clog = file('clog').read() bugs = re.findall(r'#([0-9]*)', clog) if bugs: - args['bugs'] = ','.join(bugs) + bodhi_args['bugs'] = ','.join(bugs) - template = textwrap.dedent(template) % args + template = textwrap.dedent(template) % bodhi_args # Calculate the hash of the unaltered template orig_hash = hashlib.new('sha1') @@ -721,8 +728,7 @@ def update(args): hash = pyfedpkg._hash_file('bodhi.template', 'sha1') if hash != orig_hash: cmd = ['bodhi', '--new', '--release', mymodule.branch, '--file', - 'bodhi.template', nvr, '--username', - os.getenv('BODHI_USER', os.getenv('USER'))] + 'bodhi.template', nvr, '--username', args.user] pyfedpkg._run_command(cmd, shell=True) else: log.info('Bodhi update aborted!') -- cgit