~thedac/charms/trusty/openstack-dashboard/action-managed-upgrade

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/hookenv.py

  • Committer: Liam Young
  • Date: 2015-08-03 13:59:55 UTC
  • Revision ID: liam.young@canonical.com-20150803135955-76ck6ftawnzlpxmc
[gnuoy,trivial] Pre-release charmhelper sync to pickup leadership election peer migration fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
import tempfile
35
35
from subprocess import CalledProcessError
36
36
 
37
 
from charmhelpers.cli import cmdline
 
37
try:
 
38
    from charmhelpers.cli import cmdline
 
39
except 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
38
53
 
39
54
import six
40
55
if not six.PY3: