示例#1
0
def check_master_removal(host, hostname_to_remove,
                         force=False,
                         ignore_topology_disconnect=False,
                         ignore_last_of_role=False):
    result = tasks.run_server_del(
        host,
        hostname_to_remove,
        force=force,
        ignore_topology_disconnect=ignore_topology_disconnect,
        ignore_last_of_role=ignore_last_of_role)

    assert result.returncode == 0
    if force:
        assert ("Forcing removal of {hostname}".format(
            hostname=hostname_to_remove) in result.stderr_text)

    if ignore_topology_disconnect:
        assert "Ignoring topology connectivity errors." in result.stderr_text

    if ignore_last_of_role:
        assert ("Ignoring these warnings and proceeding with removal" in
                result.stderr_text)

    tasks.assert_error(
        host.run_command(
            ['ipa', 'server-show', hostname_to_remove], raiseonerr=False
        ),
        "{}: server not found".format(hostname_to_remove),
        returncode=2
    )
示例#2
0
 def test_removal_of_master_raises_error_about_dnssec(self):
     tasks.assert_error(
         tasks.run_server_del(self.replicas[0], self.master.hostname),
         "Replica is active DNSSEC key master. Uninstall "
         "could break your DNS system. Please disable or replace "
         "DNSSEC key master first.",
         1
     )
示例#3
0
 def test_removal_of_master_raises_error_about_last_dns(self):
     """
     Now server-del should complain about the removal of last DNS server
     """
     tasks.assert_error(
         tasks.run_server_del(self.replicas[0], self.master.hostname),
         "Deleting this server will leave your installation "
         "without a DNS.",
         1
     )
示例#4
0
 def test_removal_of_master_raises_error_about_last_ca(self):
     """
     test that removal of master fails on the last
     """
     tasks.assert_error(
         tasks.run_server_del(self.replicas[0], self.master.hostname),
         "Deleting this server is not allowed as it would leave your "
         "installation without a CA.",
         1
     )
示例#5
0
 def test_removal_of_nonexistent_master_raises_error(self):
     """
     tests that removal of non-existent master raises an error
     """
     hostname = u'bogus-master.bogus.domain'
     err_message = "{}: server not found".format(hostname)
     tasks.assert_error(
         tasks.run_server_del(self.client, hostname),
         err_message,
         returncode=2
     )
示例#6
0
    def test_forced_removal_of_nonexistent_master(self):
        """
        tests that removal of non-existent master with '--force' does not raise
        an error
        """
        hostname = u'bogus-master.bogus.domain'
        result = tasks.run_server_del(self.client, hostname, force=True)
        assert result.returncode == 0
        assert ('Deleted IPA server "{}"'.format(hostname) in
                result.stdout_text)

        assert ("Server has already been deleted" in result.stderr_text)
示例#7
0
def check_removal_disconnects_topology(
        host, hostname_to_remove,
        affected_suffixes=(DOMAIN_SUFFIX_NAME,)):
    result = tasks.run_server_del(host, hostname_to_remove)
    assert len(affected_suffixes) <= 2

    err_messages_by_suffix = {
        CA_SUFFIX_NAME: REMOVAL_ERR_TEMPLATE.format(
            hostname=hostname_to_remove,
            suffix=CA_SUFFIX_NAME
        ),
        DOMAIN_SUFFIX_NAME: REMOVAL_ERR_TEMPLATE.format(
            hostname=hostname_to_remove,
            suffix=DOMAIN_SUFFIX_NAME
        )
    }

    for suffix in err_messages_by_suffix:
        if suffix in affected_suffixes:
            tasks.assert_error(
                result, err_messages_by_suffix[suffix], returncode=1)
        else:
            assert err_messages_by_suffix[suffix] not in result.stderr_text