Merge lp:~cprov/charms/trusty/tanuki-spec-manager/store-poller-fixes into lp:~tanuki/charms/trusty/tanuki-spec-manager/trunk

Proposed by Celso Providelo on 2015-09-17
Status: Merged
Approved by: Celso Providelo on 2015-09-17
Approved revision: 26
Merged at revision: 26
Proposed branch: lp:~cprov/charms/trusty/tanuki-spec-manager/store-poller-fixes
Merge into: lp:~tanuki/charms/trusty/tanuki-spec-manager/trunk
Diff against target: 40 lines (+4/-10)
2 files modified
hooks/actions.py (+3/-8)
templates/store-poller.cron (+1/-2)
To merge this branch: bzr merge lp:~cprov/charms/trusty/tanuki-spec-manager/store-poller-fixes
Reviewer Review Type Date Requested Status
Thomi Richards (community) 2015-09-17 Approve on 2015-09-17
Review via email: mp+271420@code.launchpad.net

Commit message

Fixing upgrading issue (empty hookenv.Config(), using global config) and also adjusting store-poller cron template to benefit of new logging support.

Description of the change

Fixing upgrading issue (empty hookenv.Config(), using global config) and also adjusting store-poller cron template to benefit of new logging support.

To post a comment you must log in.
Thomi Richards (thomir) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/actions.py'
2--- hooks/actions.py 2015-09-17 01:09:03 +0000
3+++ hooks/actions.py 2015-09-17 04:18:22 +0000
4@@ -328,22 +328,17 @@
5
6 if local_unit == config_unit:
7 environment = hookenv.Config()['environment']
8- log_path = os.path.join('/srv/spec-manager/', environment, 'logs/store_poller.log')
9+ log_path = os.path.join(LOG_DIR, 'store-poller.log')
10 # Create the file now, so the nagios check doesn't fail right after
11 # we've completed the deployment.
12 host.write_file(log_path,"", "www-data", "www-data")
13+ max_age_seconds = int(config['store_poller_nagios_file_age_max_minutes']) * 60
14 nrpe_compat.add_check(
15 shortname="store_poller_check",
16 description="Store poller check.",
17 check_cmd="/usr/lib/nagios/plugins/check_file_age -w {0} -c {0} -f {1}".format(
18- get_poll_frequency_in_seconds(),
19+ max_age_seconds,
20 log_path,
21 )
22 )
23 nrpe_compat.write()
24-
25-
26-def get_poll_frequency_in_seconds():
27- config = hookenv.Config()
28- max_age_minutes = int(config['store_poller_nagios_file_age_max_minutes'])
29- return max_age_minutes * 60
30
31=== modified file 'templates/store-poller.cron'
32--- templates/store-poller.cron 2015-09-16 05:34:29 +0000
33+++ templates/store-poller.cron 2015-09-17 04:18:22 +0000
34@@ -3,5 +3,4 @@
35 # Run installed `store_poller.py` script according
36 # to charm configuration.
37
38-{{ store_poller_frequency }} www-data run-one sh -c 'cd /srv/spec-manager/{{ environment }}/spec-manager && ./env/bin/python3 scripts/store_poller.py -c service.conf' 2>&1 >> /srv/spec-manager/{{ environment }}/logs/store_poller.log
39-
40+{{ store_poller_frequency }} www-data run-one sh -c 'cd /srv/spec-manager/{{ environment }}/spec-manager && LOG_DIR=../logs ./env/bin/python3 scripts/store_poller.py -c service.conf' 2>&1 >> /dev/null

Subscribers

People subscribed via source and target branches

to all changes: