Merge lp:~johnsca/charm-helpers/cmdline-conditional-import into lp:charm-helpers

Proposed by Cory Johns
Status: Merged
Merged at revision: 418
Proposed branch: lp:~johnsca/charm-helpers/cmdline-conditional-import
Merge into: lp:charm-helpers
Diff against target: 27 lines (+16/-1)
1 file modified
charmhelpers/core/hookenv.py (+16/-1)
To merge this branch: bzr merge lp:~johnsca/charm-helpers/cmdline-conditional-import
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Review via email: mp+266616@code.launchpad.net

Description of the change

Conditional import of cmdline in hookenv so that we can still avoid duplication while gracefully dealing with charms that partially sync charmhelpers directly in (sans the cli portion).

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

+1 LGTM - expressing this into upstream as it broke OpenStack CI - if this causes an issue lets bug it and circle back.

move along, this is not the droid you are looking for.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmhelpers/core/hookenv.py'
--- charmhelpers/core/hookenv.py 2015-07-29 15:33:35 +0000
+++ charmhelpers/core/hookenv.py 2015-07-31 19:46:11 +0000
@@ -34,7 +34,22 @@
34import tempfile34import tempfile
35from subprocess import CalledProcessError35from subprocess import CalledProcessError
3636
37from charmhelpers.cli import cmdline37try:
38 from charmhelpers.cli import cmdline
39except ImportError as e:
40 # due to the anti-pattern of partially synching charmhelpers directly
41 # into charms, it's possible that charmhelpers.cli is not available;
42 # if that's the case, they don't really care about using the cli anyway,
43 # so mock it out
44 if str(e) == 'No module named cli':
45 class cmdline(object):
46 @classmethod
47 def subcommand(cls, *args, **kwargs):
48 def _wrap(func):
49 return func
50 return _wrap
51 else:
52 raise
3853
39import six54import six
40if not six.PY3:55if not six.PY3:

Subscribers

People subscribed via source and target branches