Merge ~stub/postgresql-charm:syslog-departed into postgresql-charm:master

Proposed by Stuart Bishop
Status: Merged
Merged at revision: 5589acf79c8eaf4ac2b732db8fa2162621bd900b
Proposed branch: ~stub/postgresql-charm:syslog-departed
Merge into: postgresql-charm:master
Diff against target: 48 lines (+3/-25)
2 files modified
dev/null (+0/-22)
hooks/relations/syslog/provides.py (+3/-3)
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Canonical IS Reviewers Pending
Review via email: mp+399342@code.launchpad.net

Commit message

Fix syslog relation departed hook

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/hooks/defaulthook.py b/hooks/defaulthook.py
2deleted file mode 100755
3index 2e586df..0000000
4--- a/hooks/defaulthook.py
5+++ /dev/null
6@@ -1,22 +0,0 @@
7-#!/usr/bin/env python3
8-
9-# Load modules from $JUJU_CHARM_DIR/lib
10-import sys
11-
12-sys.path.append("lib")
13-
14-from charms.layer import basic
15-
16-basic.bootstrap_charm_deps()
17-basic.init_config_states()
18-
19-
20-# This will load and run the appropriate @hook and other decorated
21-# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive,
22-# and $JUJU_CHARM_DIR/hooks/relations.
23-#
24-# See https://jujucharms.com/docs/stable/authors-charm-building
25-# for more information on this pattern.
26-from charms.reactive import main
27-
28-main()
29diff --git a/hooks/relations/syslog/provides.py b/hooks/relations/syslog/provides.py
30index cad9b6e..4d1ae5b 100644
31--- a/hooks/relations/syslog/provides.py
32+++ b/hooks/relations/syslog/provides.py
33@@ -29,12 +29,12 @@ class SyslogProvides(reactive.relations.RelationBase):
34
35 @hook("{provides:syslog}-relation-departed")
36 def departed(self):
37- path = self.get_local("path")
38- if os.path.exists(path):
39+ path = self._rsyslog_conf_path(hookenv.remote_unit())
40+ if path and os.path.exists(path):
41 os.remove(path)
42 reactive.set_state("syslog.needs_restart")
43 self.remove_state("{relation_name}.available")
44- self.depart()
45+ self.conversation().depart()
46
47 def _rsyslog_conf_path(self, remote_unit):
48 # Use both the local unit and remote unit in the config file

Subscribers

People subscribed via source and target branches

to all changes: