Merge lp:~cjohnston/ubuntu-ci-services-itself/1270027 into lp:ubuntu-ci-services-itself

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 117
Merged at revision: 119
Proposed branch: lp:~cjohnston/ubuntu-ci-services-itself/1270027
Merge into: lp:ubuntu-ci-services-itself
Diff against target: 75 lines (+15/-15)
2 files modified
cli/ci_libs/ticket.py (+2/-2)
cli/ubuntu-ci (+13/-13)
To merge this branch: bzr merge lp:~cjohnston/ubuntu-ci-services-itself/1270027
Reviewer Review Type Date Requested Status
Ursula Junque (community) Approve
Review via email: mp+202133@code.launchpad.net

Commit message

Change logging to fix CLI status checks

To post a comment you must log in.
117. By Chris Johnston

Update per review

Revision history for this message
Ursula Junque (ursinha) wrote :

Can "normal output" in add_argument help be replaced by "errors only" or something along these lines? This way user knows what's the default. Other than that this looks good to me, approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cli/ci_libs/ticket.py'
2--- cli/ci_libs/ticket.py 2014-01-17 02:58:47 +0000
3+++ cli/ci_libs/ticket.py 2014-01-17 16:38:44 +0000
4@@ -104,8 +104,8 @@
5 }
6 patch(CI_URL + API_URL + 'updateticketstatus/' + self.ticket_id + '/',
7 data=data)
8- log.info("You have successfully submitted a ticket to the Ubuntu CI "
9- "Engine. Your ticket number is %s." % self.ticket_id)
10+ print("You have successfully submitted a ticket to the Ubuntu CI"
11+ " Engine. Your ticket number is %s." % self.ticket_id)
12
13 def add_new_ticket(self, args):
14 self._parse_changes(args)
15
16=== modified file 'cli/ubuntu-ci'
17--- cli/ubuntu-ci 2014-01-15 04:25:04 +0000
18+++ cli/ubuntu-ci 2014-01-17 16:38:44 +0000
19@@ -30,6 +30,10 @@
20
21 def parse_arguments(args=None):
22 parser = argparse.ArgumentParser()
23+ parser.add_argument('-v', '--verbosity', action='store', dest='verbosity',
24+ default=1, type=int, choices=[1, 2, 3],
25+ help='Verbosity level; 1=errors only, 2=verbose '
26+ 'output, 3=very verbose output')
27 subparsers = parser.add_subparsers(title='actions', help='commands')
28 ticket_parser = subparsers.add_parser('create_ticket',
29 help='Create a new ticket')
30@@ -53,10 +57,6 @@
31 help="Full path to a directory where the files "
32 "to upload are, in case they're not with "
33 "source.changes file")
34- ticket_parser.add_argument('-q', '--quiet', action='store_true',
35- default=False, help='Show only error messages.')
36- ticket_parser.add_argument('-V', '--very-verbose', action='store_true',
37- default=False, help='Show debug messages.')
38
39 ticket_parser.set_defaults(func=new_ticket)
40 status_parser = subparsers.add_parser('status',
41@@ -70,18 +70,19 @@
42
43
44 def main():
45+ logging.basicConfig()
46+ log = logging.getLogger()
47+ log.name = "ubuntu-ci"
48+
49 try:
50 args = parse_arguments()
51
52- if args.very_verbose:
53- logging.basicConfig(level=logging.DEBUG)
54- elif args.quiet:
55- logging.basicConfig(level=logging.ERROR)
56+ if args.verbosity == 2:
57+ log.setLevel(logging.INFO)
58+ elif args.verbosity > 2:
59+ log.setLevel(logging.DEBUG)
60 else:
61- logging.basicConfig(level=logging.INFO)
62-
63- log = logging.getLogger()
64- log.name = 'ubuntu-ci'
65+ log.setLevel(logging.ERROR)
66
67 args.func(args)
68 except ChangesFileNotFound, exc:
69@@ -94,6 +95,5 @@
70 except Exception, exc:
71 log.critical(exc)
72
73-
74 if __name__ == "__main__":
75 main()

Subscribers

People subscribed via source and target branches