summaryrefslogtreecommitdiff
blob: d8160dcca0227d25a0134e1d0fd8796723eab933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import print_function

import bugzilla

URL = "https://bugs.gentoo.org/xmlrpc.cgi"
def addnewbug(args):
	bzapi = bugzilla.Bugzilla(URL)
	print(args['username'])
	print(args['password'])
	bzapi.login(user=args['username'], password=args['password'])
	createinfo = bzapi.build_createbug(
		product=args['product'],
		version=args['version'],
		component=args['component'],
		summary=args['summary'],
		description=args['description'],
		assigned_to=args['assigned_to'])
	newbug = bzapi.createbug(createinfo)
	print("Created new bug id=%s url=%s" % (newbug.id, newbug.weburl))
	update = bzapi.build_update(comment=args['comment'])
	bzapi.update_bugs(newbug.id, update)
	kwards = {
		'contenttype': args['content_type'],
	}
	attchment_id = bzapi.attachfile(newbug.id, args['filename'], args['comment_attach'], **kwards)
	bzapi.logout()
	return newbug