~1chb1n/charms/trusty/hacluster/next.1601-test-update2

« back to all changes in this revision

Viewing changes to hooks/maas.py

  • Committer: Billy Olsen
  • Date: 2015-05-01 12:43:29 UTC
  • mfrom: (43.2.8 hacluster.cleanup)
  • Revision ID: billy.olsen@canonical.com-20150501124329-aj6vf5rw9ce95n47
[hopem,r=wolsen]

Refactor and clean-up the hacluster charm.
This makes the code format and layout more consistent with
the rest of the openstack charms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import subprocess
5
5
 
6
6
from charmhelpers.fetch import apt_install
7
 
from charmhelpers.core.hookenv import log, ERROR
 
7
from charmhelpers.core.hookenv import (
 
8
    log,
 
9
    ERROR,
 
10
)
8
11
 
9
12
MAAS_STABLE_PPA = 'ppa:maas-maintainers/stable '
10
13
MAAS_PROFILE_NAME = 'maas-juju-hacluster'
18
21
        self.install_maas_cli()
19
22
 
20
23
    def install_maas_cli(self):
21
 
        '''
22
 
        Ensure maas-cli is installed.  Fallback to MAAS stable PPA when
23
 
        needed.
24
 
        '''
 
24
        """Ensure maas-cli is installed
 
25
 
 
26
        Fallback to MAAS stable PPA when needed.
 
27
        """
25
28
        apt.init()
26
29
        cache = apt.Cache()
27
30
 
59
62
        except subprocess.CalledProcessError:
60
63
            log('Could not get node inventory from MAAS.', ERROR)
61
64
            return False
 
65
 
62
66
        self.logout()
63
67
        return json.loads(out)