Commit 11e0fc0 Log at DEBUG by default and log an user friendly URL for the admins

2 files Authored and Committed by pingou 7 months ago
Log at DEBUG by default and log an user friendly URL for the admins

That url allows the admin to go and see by themselves what simple-koji-ci
did on the pull-request.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

    
 1 @@ -46,4 +46,15 @@
 2       # The number of times the-new-hotness should retry a network request that
 3       # that failed for any reason (e.g. read timeout, DNS error, etc)
 4       'simple-koji-ci.requests_retries': 3,
 5 + 
 6 +     'logging': {
 7 +         'loggers': {
 8 +             'simple_koji_ci': {
 9 +                 "level": "DEBUG",
10 +                 "propagate": False,
11 +                 "handlers": ["console"],
12 +             },
13 +         },
14 +     },
15 + 
16   }
 1 @@ -335,7 +335,7 @@
 2           pk_info = self.scratch_builds[task_id]
 3   
 4           pagure_url = self.config["simple-koji-ci.pagure_url"].rstrip('/')
 5 -         target_url = '/'.join([
 6 +         target_url = pagure_url + '/' + '/'.join([
 7               'api',
 8               '0',
 9               pk_info['namespace'],
10 @@ -344,8 +344,13 @@
11               str(pk_info['prid']),
12               'flag'
13           ])
14 -         pagure_url = pagure_url + '/' + target_url
15 -         _log.info('Flagging PR at: %s' % pagure_url)
16 +         pr_url = pagure_url + '/' + '/'.join([
17 +             pk_info['namespace'],
18 +             pk_info['name'],
19 +             'pull-request',
20 +             str(pk_info['prid'])
21 +         ])
22 +         _log.info('Flagging PR at: %s' % target_url)
23   
24           headers = {
25               "Authorization": "token "
26 @@ -359,11 +364,12 @@
27   
28           req = self.requests_session.request(
29               method='POST',
30 -             url=pagure_url,
31 +             url=target_url,
32               headers=headers,
33               data=data,
34           )
35 -         _log.info('Request to %s returned: %s' % (pagure_url, req.status_code))
36 +         _log.info('Request to %s returned: %s' % (target_url, req.status_code))
37 +         _log.info('Check it at: %s' % pr_url)
38           _log.debug(req.text)
39           if not req.ok:
40               _log.debug(req.text)