Merge lp:~tribaal/charms/trusty/landscape-client/additional-logging into lp:charms/trusty/landscape-client

Proposed by Chris Glass
Status: Merged
Merged at revision: 40
Proposed branch: lp:~tribaal/charms/trusty/landscape-client/additional-logging
Merge into: lp:charms/trusty/landscape-client
Diff against target: 77 lines (+16/-1)
2 files modified
hooks/common.py (+13/-0)
hooks/hooks.py (+3/-1)
To merge this branch: bzr merge lp:~tribaal/charms/trusty/landscape-client/additional-logging
Reviewer Review Type Date Requested Status
Free Ekanayaka (community) Approve
Adam Collard Approve
Review via email: mp+223598@code.launchpad.net

Description of the change

This branch adds more logging to the landscape-client charm (to help narrow a race condition).

To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) wrote :

Minor comments about the messages below

review: Approve
43. By Chris Glass

Addressed review comments

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Have comments on the messages too. +1 otherwise

review: Approve
Revision history for this message
Chris Glass (tribaal) :
44. By Chris Glass

Addressed review comments

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/common.py'
2--- hooks/common.py 2014-06-13 15:43:58 +0000
3+++ hooks/common.py 2014-06-23 11:26:19 +0000
4@@ -5,6 +5,9 @@
5 from pwd import getpwnam
6 from subprocess import check_output
7
8+from charmhelpers.core.hookenv import (
9+ log, local_unit)
10+
11 from landscape.configuration import (
12 setup, register, LandscapeSetupConfiguration, ConfigurationError,
13 stop_client_and_disable_init_script)
14@@ -52,6 +55,7 @@
15
16 def __init__(self):
17 self.config = Configuration()
18+ self.local_unit = local_unit()
19
20 def update_client_config(self, service_config, try_to_register=True):
21 """Update the client config.
22@@ -123,10 +127,18 @@
23 If an error is encountered, the client will be disabled and the hook
24 calling this function will exit with an error code.
25 """
26+ log("Updating client configuration for %s" % self.local_unit)
27 error_handler = ErrorHandler()
28
29 sysvconfig = SysVConfig()
30 configured = sysvconfig.is_configured_to_run()
31+ if configured:
32+ log("%s: landscape-client is configured to run as per sysvconfig"
33+ "" % self.local_unit)
34+ else:
35+ log("%s: landscape-client is not configured to run as per "
36+ "sysvconfig" % self.local_unit)
37+
38 config = LandscapeSetupConfiguration()
39 config.load([])
40 config.silent = True
41@@ -139,6 +151,7 @@
42 print >> sys.stderr, "Configuration error: %s" % (str(error),)
43 error_handler.flag_error(1)
44 else:
45+ log("Registering %s" % self.local_unit)
46 register(config, on_error=error_handler.flag_error)
47 return error_handler.exit_code
48
49
50=== modified file 'hooks/hooks.py'
51--- hooks/hooks.py 2014-06-13 15:43:58 +0000
52+++ hooks/hooks.py 2014-06-23 11:26:19 +0000
53@@ -7,7 +7,7 @@
54 import subprocess
55
56 from charmhelpers.core.hookenv import (
57- Hooks, UnregisteredHookError, log)
58+ Hooks, UnregisteredHookError, log, local_unit)
59 from charmhelpers.fetch import (
60 apt_install, _run_apt_command, add_source, apt_update)
61 from charmhelpers.core.hookenv import config
62@@ -70,6 +70,7 @@
63 @param relation_data: data from the context of a relation, it should
64 match the data in the config
65 """
66+ log("In config-changed for %s" % local_unit())
67 if relation_data is None:
68 relation_data = {}
69 service_config = juju_broker.get_service_config()
70@@ -95,6 +96,7 @@
71 @hooks.hook("container-relation-joined", "ceph-client-relation-joined")
72 def container_relation_joined(juju_broker=JUJU_BROKER,
73 landscape_broker=LANDSCAPE_BROKER):
74+ log("In container-relation-joined for %s" % local_unit())
75 landscape_broker.config.reload()
76 relation_conf = juju_broker.get_relation_config()
77 remote_unit_name = juju_broker.environment.get("JUJU_REMOTE_UNIT")

Subscribers

People subscribed via source and target branches