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
=== modified file 'cli/ci_libs/ticket.py'
--- cli/ci_libs/ticket.py 2014-01-17 02:58:47 +0000
+++ cli/ci_libs/ticket.py 2014-01-17 16:38:44 +0000
@@ -104,8 +104,8 @@
104 }104 }
105 patch(CI_URL + API_URL + 'updateticketstatus/' + self.ticket_id + '/',105 patch(CI_URL + API_URL + 'updateticketstatus/' + self.ticket_id + '/',
106 data=data)106 data=data)
107 log.info("You have successfully submitted a ticket to the Ubuntu CI "107 print("You have successfully submitted a ticket to the Ubuntu CI"
108 "Engine. Your ticket number is %s." % self.ticket_id)108 " Engine. Your ticket number is %s." % self.ticket_id)
109109
110 def add_new_ticket(self, args):110 def add_new_ticket(self, args):
111 self._parse_changes(args)111 self._parse_changes(args)
112112
=== modified file 'cli/ubuntu-ci'
--- cli/ubuntu-ci 2014-01-15 04:25:04 +0000
+++ cli/ubuntu-ci 2014-01-17 16:38:44 +0000
@@ -30,6 +30,10 @@
3030
31def parse_arguments(args=None):31def parse_arguments(args=None):
32 parser = argparse.ArgumentParser()32 parser = argparse.ArgumentParser()
33 parser.add_argument('-v', '--verbosity', action='store', dest='verbosity',
34 default=1, type=int, choices=[1, 2, 3],
35 help='Verbosity level; 1=errors only, 2=verbose '
36 'output, 3=very verbose output')
33 subparsers = parser.add_subparsers(title='actions', help='commands')37 subparsers = parser.add_subparsers(title='actions', help='commands')
34 ticket_parser = subparsers.add_parser('create_ticket',38 ticket_parser = subparsers.add_parser('create_ticket',
35 help='Create a new ticket')39 help='Create a new ticket')
@@ -53,10 +57,6 @@
53 help="Full path to a directory where the files "57 help="Full path to a directory where the files "
54 "to upload are, in case they're not with "58 "to upload are, in case they're not with "
55 "source.changes file")59 "source.changes file")
56 ticket_parser.add_argument('-q', '--quiet', action='store_true',
57 default=False, help='Show only error messages.')
58 ticket_parser.add_argument('-V', '--very-verbose', action='store_true',
59 default=False, help='Show debug messages.')
6060
61 ticket_parser.set_defaults(func=new_ticket)61 ticket_parser.set_defaults(func=new_ticket)
62 status_parser = subparsers.add_parser('status',62 status_parser = subparsers.add_parser('status',
@@ -70,18 +70,19 @@
7070
7171
72def main():72def main():
73 logging.basicConfig()
74 log = logging.getLogger()
75 log.name = "ubuntu-ci"
76
73 try:77 try:
74 args = parse_arguments()78 args = parse_arguments()
7579
76 if args.very_verbose:80 if args.verbosity == 2:
77 logging.basicConfig(level=logging.DEBUG)81 log.setLevel(logging.INFO)
78 elif args.quiet:82 elif args.verbosity > 2:
79 logging.basicConfig(level=logging.ERROR)83 log.setLevel(logging.DEBUG)
80 else:84 else:
81 logging.basicConfig(level=logging.INFO)85 log.setLevel(logging.ERROR)
82
83 log = logging.getLogger()
84 log.name = 'ubuntu-ci'
8586
86 args.func(args)87 args.func(args)
87 except ChangesFileNotFound, exc:88 except ChangesFileNotFound, exc:
@@ -94,6 +95,5 @@
94 except Exception, exc:95 except Exception, exc:
95 log.critical(exc)96 log.critical(exc)
9697
97
98if __name__ == "__main__":98if __name__ == "__main__":
99 main()99 main()

Subscribers

People subscribed via source and target branches