Ubuntu Pastebin

Paste from Nate Finch at Mon, 1 Jun 2015 16:34:12 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class EnvJujuClient:

    @classmethod
    def by_version(cls, env, juju_path=None, debug=False):
        version = cls.get_version(juju_path)
        if juju_path is None:
            full_path = cls.get_full_path()
        else:
            full_path = os.path.abspath(juju_path)
        if version.startswith('1.16'):
            raise Exception('Unsupported juju: %s' % version)
        elif re.match('^1\.22[.-]', version):
            return EnvJujuClient22(env, version, full_path, debug=debug)
        elif re.match('^1\.24[.-]', version):
            return EnvJujuClient24(env, version, full_path, debug=debug)
        else:
            return EnvJujuClient(env, version, full_path, debug=debug)



class EnvJujuClient22(EnvJujuClient):

    def _shell_environ(self, juju_home=None):
        """Generate a suitable shell environment.

        Juju's directory must be in the PATH to support plugins.
        """
        env = super(EnvJujuClient22, self)._shell_environ(juju_home)
        if env.get(JUJU_DEV_FEATURE_FLAGS) == "":
            env[JUJU_DEV_FEATURE_FLAGS] = 'actions'
        else:
            env[JUJU_DEV_FEATURE_FLAGS] += ',actions'
        return env
Download as text