def __init__(self, *args, **kw): super(TracService, self).__init__(*args, **kw) uri = 'https://%s:%s@%s/login/xmlrpc' % ( self.config.get(self.target, 'trac.username'), self.config.get(self.target, 'trac.password'), self.config.get(self.target, 'trac.base_uri'), ) self.trac = offtrac.TracServer(uri)
def new_ticket(self, passwd, desc, build=None): """Open a new ticket on Rel-Eng trac instance. Get ticket component and assignee from current branch Create a new task ticket using username/password/desc Discover build nvr from module or optional build argument Return ticket number on success """ override = self.override if not override: raise RuntimeError( 'Override tag is not required for %s' % self.branch_merge ) uri = self.tracbaseurl % {'user': self.user, 'password': passwd} self.trac = offtrac.TracServer(uri) # Set trac's component and assignee from related distvar if self.distvar == 'fedora': component = 'koji' #owner = '*****@*****.**' elif self.distvar == 'rhel': component = 'epel' #owner = '*****@*****.**' # Raise if people request a tag against something that self updates build_target = self.anon_kojisession.getBuildTarget(self.target) if not build_target: raise RuntimeError('Unknown build target: %s' % self.target) dest_tag = self.anon_kojisession.getTag(build_target['dest_tag_name']) ancestors = self.anon_kojisession.getFullInheritance( build_target['build_tag'] ) if dest_tag['id'] in [build_target['build_tag']] + \ [ancestor['parent_id'] for ancestor in ancestors]: raise RuntimeError('Override tag is not required for %s' % self.branch_merge) if not build: build = self.nvr summary = 'Tag request %s for %s' % (build, override) type = 'task' try: ticket = self.trac.create_ticket( summary, desc, component=component, notify=True ) except Exception, e: raise RuntimeError('Could not request tag %s: %s' % (build, e))
def __init__(self, *args, **kw): super(TracService, self).__init__(*args, **kw) base_uri = self.config_get('base_uri') username = self.config_get('username') password = self.config_get('password') if not password or password.startswith('@oracle:'): password = get_service_password( self.get_keyring_service(self.config, self.target), username, oracle=password, interactive=self.config.interactive) auth = '%s:%s' % (username, password) uri = 'https://%s@%s/login/xmlrpc' % (urllib.quote_plus(auth), base_uri) self.trac = offtrac.TracServer(uri)
def __init__(self, *args, **kw): super(TracService, self).__init__(*args, **kw) base_uri = self.config.get('base_uri') scheme = self.config.get('scheme', default='https') username = self.config.get('username', default=None) if username: password = self.get_password('password', username) auth = urllib.parse.quote_plus('%s:%s' % (username, password)) + '@' else: auth = '' if self.config.get('no_xmlrpc', default=False, to_type=asbool): uri = '%s://%s%s/' % (scheme, auth, base_uri) self.uri = uri self.trac = None else: uri = '%s://%s%s/login/xmlrpc' % (scheme, auth, base_uri) self.trac = offtrac.TracServer(uri)
def __init__(self, *args, **kw): super(TracService, self).__init__(*args, **kw) base_uri = self.config_get('base_uri') scheme = self.config_get_default('scheme', default='https') username = self.config_get_default('username', default=None) if username: password = self.config_get('password') if not password or password.startswith('@oracle:'): password = get_service_password( self.get_keyring_service(self.config, self.target), username, oracle=password, interactive=self.config.interactive) auth = urllib.quote_plus('%s:%s' % (username, password)) + '@' else: auth = '' if self.config_get_default('no_xmlrpc', default=False): uri = '%s://%s%s/' % (scheme, auth, base_uri) self.uri = uri self.trac = None else: uri = '%s://%s%s/login/xmlrpc' % (scheme, auth, base_uri) self.trac = offtrac.TracServer(uri)
action_parser = setup_action_parser(action) (actopt, actargs) = action_parser.parse_args(args) if not opts.user: opts.user = raw_input('Username: '******'Password for %s: ' % opts.user) if not opts.project: opts.project = raw_input('Project space: ') # Create the TracServ object uri = 'https://%s:%s@%s/%s/login/xmlrpc' % (opts.user, opts.password, BASEURL, opts.project) trac = offtrac.TracServer(uri) # Try to do something if action == "list-tickets": # setup the query string query = "status%s" % actopt.status if actopt.owner: query += "&owner=%s" % actopt.owner if actopt.component: query += "&component=%s" % actopt.component if actopt.type: query += "&type=%s" % actopt.type results = trac.query_tickets(query) print results