~openstack-charmers-next/charms/trusty/glance/trunk

« back to all changes in this revision

Viewing changes to charmhelpers/contrib/openstack/ha/utils.py

  • Committer: James Page
  • Author(s): David Ames
  • Date: 2016-06-23 08:23:00 UTC
  • Revision ID: james.page@ubuntu.com-20160623082300-dtbemde6sqwacnph
DNS HA

Implement DNS high availability. Pass the correct information to
hacluster to register a DNS entry with MAAS 2.0 or greater rather
than using a virtual IP.

Charm-helpers sync to bring in DNS HA helpers

Change-Id: Icc9bfb16e07ca6cf5475182b1974b09949cd89b6

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    DEBUG,
37
37
)
38
38
 
 
39
from charmhelpers.core.host import (
 
40
    lsb_release
 
41
)
 
42
 
39
43
from charmhelpers.contrib.openstack.ip import (
40
44
    resolve_address,
41
45
)
63
67
                    DNS HA
64
68
    """
65
69
 
 
70
    # Validate the charm environment for DNS HA
 
71
    assert_charm_supports_dns_ha()
 
72
 
66
73
    settings = ['os-admin-hostname', 'os-internal-hostname',
67
 
                'os-public-hostname']
 
74
                'os-public-hostname', 'os-access-hostname']
68
75
 
69
76
    # Check which DNS settings are set and update dictionaries
70
77
    hostname_group = []
109
116
        msg = 'DNS HA: Hostname group has no members.'
110
117
        status_set('blocked', msg)
111
118
        raise DNSHAException(msg)
 
119
 
 
120
 
 
121
def assert_charm_supports_dns_ha():
 
122
    """Validate prerequisites for DNS HA
 
123
    The MAAS client is only available on Xenial or greater
 
124
    """
 
125
    if lsb_release().get('DISTRIB_RELEASE') < '16.04':
 
126
        msg = ('DNS HA is only supported on 16.04 and greater '
 
127
               'versions of Ubuntu.')
 
128
        status_set('blocked', msg)
 
129
        raise DNSHAException(msg)
 
130
    return True