Beispiel #1
0
def validate_dns_ha():
    """Validate the DNS HA

    Assert the charm will support DNS HA
    Check MAAS related configuration options are properly set
    """

    # Will raise an exception if unable to continue
    assert_charm_supports_dns_ha()

    if config('maas_url') and config('maas_credentials'):
        return True
    else:
        msg = ("DNS HA is requested but the maas_url or maas_credentials "
               "settings are not set")
        status_set('blocked', msg)
        raise MAASConfigIncomplete(msg)
Beispiel #2
0
def validate_dns_ha():
    """Validate the DNS HA

    Assert the charm will support DNS HA
    Check MAAS related configuration options are properly set

    :raises MAASConfigIncomplete: if maas_url and maas_credentials are not set
    """

    # Will raise an exception if unable to continue
    assert_charm_supports_dns_ha()

    if config('maas_url') and config('maas_credentials'):
        return True
    else:
        msg = ("DNS HA is requested but the maas_url or maas_credentials "
               "settings are not set")
        raise MAASConfigIncomplete(msg)
Beispiel #3
0
 def test_assert_charm_supports_dns_ha_exception(self, lsb_release):
     lsb_release.return_value = {'DISTRIB_RELEASE': '12.04'}
     self.assertRaises(ha.DNSHAException,
                       lambda: ha.assert_charm_supports_dns_ha())
Beispiel #4
0
 def test_assert_charm_supports_dns_ha(self, lsb_release):
     lsb_release.return_value = {'DISTRIB_RELEASE': '16.04'}
     self.assertTrue(ha.assert_charm_supports_dns_ha())