Merge lp:~abentley/charms/precise/juju-reports/new-script-logging into lp:~juju-qa/charms/precise/juju-reports/trunk

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 44
Proposed branch: lp:~abentley/charms/precise/juju-reports/new-script-logging
Merge into: lp:~juju-qa/charms/precise/juju-reports/trunk
Diff against target: 70 lines (+16/-6)
3 files modified
config.yaml (+4/-0)
hooks/common.py (+10/-4)
templates/crontab.tmpl (+2/-2)
To merge this branch: bzr merge lp:~abentley/charms/precise/juju-reports/new-script-logging
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+231596@code.launchpad.net

Commit message

Support new script logging.

Description of the change

This branch supports the new script logging by
1. accepting error-email-from.
2. propagating error-email-from and error-email into production.ini.
3. refusing to install the crontab until these are set.
4. Updating the crontab to use the --email-logs and --log-file options.

As a driveby, used the get-s3-ci-results script instead of using python to run its module, jujureports.jobs.releases.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is fine to merge after lp:~abentley/juju-reports/logging-fixes is merged.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-08-08 18:55:10 +0000
3+++ config.yaml 2014-08-20 17:06:15 +0000
4@@ -16,6 +16,10 @@
5 type: string
6 default: ""
7 description: "Address to mail errors to."
8+ error-email-from:
9+ type: string
10+ default: ""
11+ description: "Address to mail errors from."
12 lp-key:
13 type: string
14 default: ""
15
16=== modified file 'hooks/common.py'
17--- hooks/common.py 2014-08-14 16:48:49 +0000
18+++ hooks/common.py 2014-08-20 17:06:15 +0000
19@@ -34,7 +34,8 @@
20 return os.path.join(PROJECT_DIR, 'resources/{}.template'.format(name))
21
22
23-def install_ini(mongo_url, gh_token, jujuci_url, token):
24+def install_ini(mongo_url, gh_token, jujuci_url, token, error_email,
25+ error_email_from):
26 config = ConfigParser()
27 path = get_template_path(INI)
28 if not os.path.exists(path):
29@@ -45,6 +46,8 @@
30 config.set('app:main', 'jujuci.url', jujuci_url)
31 config.set('app:main', 'charm_bundle_test_token', token)
32 config.set('app:main', 'home', HOME)
33+ config.set('app:main', 'error_email', error_email)
34+ config.set('app:main', 'error_email_from', error_email_from)
35 config.write(open(get_ini_path(), 'w'))
36 return config
37
38@@ -272,10 +275,13 @@
39 hookenv.log('No mongodb set up.')
40 return
41 ini = install_ini(mongo_url, config['gh-token'], config['jujuci-url'],
42- config['charm-bundle-test-token'])
43+ config['charm-bundle-test-token'],
44+ config['error-email'], ['error-email-from'])
45 configure_s3(config)
46- unset = [key for key in ['lp-key', 'lp-oauth', 'gh-token',
47- 'charm-bundle-test-token'] if config[key] == '']
48+ unset = [key for key in [
49+ 'lp-key', 'lp-oauth', 'gh-token', 'charm-bundle-test-token',
50+ 'error-email', 'error-email-from'
51+ ] if config[key] == '']
52 if len(unset) > 0:
53 hookenv.log('Not setting up cron because {} not set.'.format(
54 ', '.join(unset)))
55
56=== modified file 'templates/crontab.tmpl'
57--- templates/crontab.tmpl 2014-08-15 19:47:25 +0000
58+++ templates/crontab.tmpl 2014-08-20 17:06:15 +0000
59@@ -2,9 +2,9 @@
60 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
61 $error_email
62
63-* * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/cbtest > /dev/null && INI=$reports_home/production.ini $reports_home/bin/store-trigger > /dev/null 2> /dev/null
64+* * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/cbtest --email-logs --log-file $reports_home/cbtest.log && INI=$reports_home/production.ini $reports_home/bin/store-trigger --email-logs --log-file $reports_home/store-trigger.log
65 */$interval * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/python $reports_home/jujureports/jobs/jujuci.py
66-*/$interval * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/python $reports_home/jujureports/jobs/releases.py
67+*/$interval * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/get-s3-ci-results --email-logs --log-file $reports_home/get-s3-ci-results.log
68 # */$interval * * * * ubuntu INI=$reports_home/production.ini $reports_home/bin/python $reports_home/jujureports/jobs/charm_testing.py
69 # The weekday below should match the value scorecard.collection_day
70 # in the file production.ini in lp:juju-reports.

Subscribers

People subscribed via source and target branches

to all changes: