Merge lp:~brad-marshall/charms/trusty/thruk-agent/fix-livestatus-perms into lp:~canonical-bootstack/charms/trusty/thruk-agent/trunk

Proposed by Brad Marshall
Status: Merged
Merged at revision: 33
Proposed branch: lp:~brad-marshall/charms/trusty/thruk-agent/fix-livestatus-perms
Merge into: lp:~canonical-bootstack/charms/trusty/thruk-agent/trunk
Diff against target: 24 lines (+4/-3)
1 file modified
hooks/actions.py (+4/-3)
To merge this branch: bzr merge lp:~brad-marshall/charms/trusty/thruk-agent/fix-livestatus-perms
Reviewer Review Type Date Requested Status
Jill Rouleau (community) lgtm Approve
Review via email: mp+269128@code.launchpad.net

Description of the change

Fix file perms on livestatus path and directory.

To post a comment you must log in.
Revision history for this message
Jill Rouleau (jillrouleau) :
review: Approve (lgtm)

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-05-04 07:15:29 +0000
3+++ hooks/actions.py 2015-08-25 23:02:19 +0000
4@@ -28,11 +28,13 @@
5 def fix_livestatus_perms(service_name):
6 livestatus_path = hookenv.config('livestatus_path')
7 if os.path.exists(livestatus_path):
8+ livestatus_dir = os.path.dirname(livestatus_path)
9 uid = pwd.getpwnam("nagios").pw_uid
10 gid = grp.getgrnam("www-data").gr_gid
11 os.chown(livestatus_path, uid, gid)
12- st = os.stat(livestatus_path)
13- os.chmod(livestatus_path, st.st_mode | stat.S_IRGRP)
14+ os.chown(livestatus_dir, uid, gid)
15+ os.chmod(livestatus_path, 0770)
16+ os.chmod(livestatus_dir, 02771)
17 fixpath(livestatus_path)
18 else:
19 hookenv.log("ERROR: livestatus socket doesn't exist")
20@@ -79,4 +81,3 @@
21
22 for rel_id in hookenv.relation_ids('thruk-agent'):
23 hookenv.relation_set(relation_id=rel_id, relation_settings=thruk_data)
24-

Subscribers

People subscribed via source and target branches