Merge lp:~niedbalski/charm-helpers/fix-lp1255933 into lp:charm-helpers

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 264
Proposed branch: lp:~niedbalski/charm-helpers/fix-lp1255933
Merge into: lp:charm-helpers
Diff against target: 42 lines (+8/-1)
3 files modified
charmhelpers/core/hookenv.py (+2/-0)
charmhelpers/core/host.py (+1/-1)
tests/core/test_hookenv.py (+5/-0)
To merge this branch: bzr merge lp:~niedbalski/charm-helpers/fix-lp1255933
Reviewer Review Type Date Requested Status
Felipe Reyes (community) Approve
charmers Pending
Review via email: mp+242920@code.launchpad.net

Description of the change

Fix bug LP: #1255933

To post a comment you must log in.
261. By Tom Haddon

[gnuoy,r=mthaddon] add default servicegroup of 'juju' to nagios config if one isn't defined

262. By Jorge Niedbalski

[corey.bryant r=niedbalski] Added git support for openstack utils

263. By Jorge Niedbalski

[tests] added test for hookenv.log with passing object

Revision history for this message
Felipe Reyes (freyes) wrote :

Jorge, LGTM.

Best,

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/core/hookenv.py'
2--- charmhelpers/core/hookenv.py 2014-11-25 15:07:02 +0000
3+++ charmhelpers/core/hookenv.py 2014-12-04 18:12:36 +0000
4@@ -68,6 +68,8 @@
5 command = ['juju-log']
6 if level:
7 command += ['-l', level]
8+ if not isinstance(message, six.string_types):
9+ message = repr(message)
10 command += [message]
11 subprocess.call(command)
12
13
14=== modified file 'charmhelpers/core/host.py'
15--- charmhelpers/core/host.py 2014-12-03 13:27:17 +0000
16+++ charmhelpers/core/host.py 2014-12-04 18:12:36 +0000
17@@ -388,8 +388,8 @@
18
19 '''
20 import apt_pkg
21- from charmhelpers.fetch import apt_cache
22 if not pkgcache:
23+ from charmhelpers.fetch import apt_cache
24 pkgcache = apt_cache()
25 pkg = pkgcache[package]
26 return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)
27
28=== modified file 'tests/core/test_hookenv.py'
29--- tests/core/test_hookenv.py 2014-11-25 15:07:02 +0000
30+++ tests/core/test_hookenv.py 2014-12-04 18:12:36 +0000
31@@ -233,6 +233,11 @@
32 mock_call.assert_called_with(['juju-log', 'foo'])
33
34 @patch('subprocess.call')
35+ def test_logs_messages_object(self, mock_call):
36+ hookenv.log(object)
37+ mock_call.assert_called_with(['juju-log', "<class 'object'>"])
38+
39+ @patch('subprocess.call')
40 def test_logs_messages_with_alternative_levels(self, mock_call):
41 alternative_levels = [
42 hookenv.CRITICAL,

Subscribers

People subscribed via source and target branches