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
diff --git a/hooks/defaulthook.py b/hooks/defaulthook.py
0deleted file mode 1007550deleted file mode 100755
index 2e586df..0000000
--- a/hooks/defaulthook.py
+++ /dev/null
@@ -1,22 +0,0 @@
1#!/usr/bin/env python3
2
3# Load modules from $JUJU_CHARM_DIR/lib
4import sys
5
6sys.path.append("lib")
7
8from charms.layer import basic
9
10basic.bootstrap_charm_deps()
11basic.init_config_states()
12
13
14# This will load and run the appropriate @hook and other decorated
15# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive,
16# and $JUJU_CHARM_DIR/hooks/relations.
17#
18# See https://jujucharms.com/docs/stable/authors-charm-building
19# for more information on this pattern.
20from charms.reactive import main
21
22main()
diff --git a/hooks/relations/syslog/provides.py b/hooks/relations/syslog/provides.py
index cad9b6e..4d1ae5b 100644
--- a/hooks/relations/syslog/provides.py
+++ b/hooks/relations/syslog/provides.py
@@ -29,12 +29,12 @@ class SyslogProvides(reactive.relations.RelationBase):
2929
30 @hook("{provides:syslog}-relation-departed")30 @hook("{provides:syslog}-relation-departed")
31 def departed(self):31 def departed(self):
32 path = self.get_local("path")32 path = self._rsyslog_conf_path(hookenv.remote_unit())
33 if os.path.exists(path):33 if path and os.path.exists(path):
34 os.remove(path)34 os.remove(path)
35 reactive.set_state("syslog.needs_restart")35 reactive.set_state("syslog.needs_restart")
36 self.remove_state("{relation_name}.available")36 self.remove_state("{relation_name}.available")
37 self.depart()37 self.conversation().depart()
3838
39 def _rsyslog_conf_path(self, remote_unit):39 def _rsyslog_conf_path(self, remote_unit):
40 # Use both the local unit and remote unit in the config file40 # Use both the local unit and remote unit in the config file

Subscribers

People subscribed via source and target branches

to all changes: