ipatests: do not configure nameserver when installing client and replica

When IPA master is installed without DNS, using it as nameserver creates
invalid configuration.

Related to https://pagure.io/freeipa/issue/8703

Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
Sergey Orlov 2021-02-17 12:23:33 +01:00
parent 4ad5ce7b58
commit 881eea4efe
No known key found for this signature in database
GPG Key ID: ADF8C90EDD04503D
7 changed files with 78 additions and 41 deletions

View File

@ -69,4 +69,5 @@ class TestCustomDSConfigInstall(IntegrationTest):
def test_customized_ds_install_replica(self):
tasks.install_replica(
self.master, self.replicas[0], setup_ca=False,
nameservers=None,
extra_args=['--dirsrv-config-file', CONFIG_LDIF_PATH])

View File

@ -304,7 +304,8 @@ class TestInstallDNSSECFirst(IntegrationTest):
# support before
Firewall(cls.master).enable_services(["dns"])
tasks.install_replica(cls.master, cls.replicas[0], setup_dns=True)
tasks.install_replica(cls.master, cls.replicas[0], setup_dns=True,
nameservers=None)
# backup trusted key
tasks.backup_file(cls.master, paths.DNSSEC_TRUSTED_KEY)

View File

@ -62,13 +62,16 @@ class InstallTestBase1(IntegrationTest):
num_replicas = 3
topology = 'star'
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
def test_replica0_ca_less_install(self):
tasks.install_replica(self.master, self.replicas[0], setup_ca=False)
tasks.install_replica(
self.master, self.replicas[0], setup_ca=False,
nameservers='master' if self.master_with_dns else None)
def test_replica0_ipa_ca_install(self):
tasks.install_ca(self.replicas[0])
@ -80,7 +83,9 @@ class InstallTestBase1(IntegrationTest):
tasks.install_dns(self.replicas[0])
def test_replica1_with_ca_install(self):
tasks.install_replica(self.master, self.replicas[1], setup_ca=True)
tasks.install_replica(
self.master, self.replicas[1], setup_ca=True,
nameservers='master' if self.master_with_dns else None)
def test_replica1_ipa_kra_install(self):
tasks.install_kra(self.replicas[1])
@ -89,8 +94,9 @@ class InstallTestBase1(IntegrationTest):
tasks.install_dns(self.replicas[1])
def test_replica2_with_ca_kra_install(self):
tasks.install_replica(self.master, self.replicas[2], setup_ca=True,
setup_kra=True)
tasks.install_replica(
self.master, self.replicas[2], setup_ca=True, setup_kra=True,
nameservers='master' if self.master_with_dns else None)
def test_replica2_ipa_dns_install(self):
tasks.install_dns(self.replicas[2])
@ -100,21 +106,24 @@ class InstallTestBase2(IntegrationTest):
num_replicas = 3
topology = 'star'
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
def test_replica1_with_ca_dns_install(self):
tasks.install_replica(self.master, self.replicas[1], setup_ca=True,
setup_dns=True)
tasks.install_replica(
self.master, self.replicas[1], setup_ca=True, setup_dns=True,
nameservers='master' if self.master_with_dns else None)
def test_replica1_ipa_kra_install(self):
tasks.install_kra(self.replicas[1])
def test_replica2_with_dns_install(self):
tasks.install_replica(self.master, self.replicas[2], setup_ca=False,
setup_dns=True)
tasks.install_replica(
self.master, self.replicas[2], setup_ca=False, setup_dns=True,
nameservers='master' if self.master_with_dns else None)
def test_replica2_ipa_ca_install(self):
tasks.install_ca(self.replicas[2])
@ -130,20 +139,25 @@ class ADTrustInstallTestBase(IntegrationTest):
"""
num_replicas = 2
topology = 'star'
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
def install_replica(self, replica, **kwargs):
tasks.install_replica(self.master, replica, setup_adtrust=True,
**kwargs)
def test_replica0_only_adtrust(self):
self.install_replica(self.replicas[0], setup_ca=False)
self.install_replica(
self.replicas[0], setup_ca=False,
nameservers='master' if self.master_with_dns else None)
def test_replica1_all_components_adtrust(self):
self.install_replica(self.replicas[1], setup_ca=True)
self.install_replica(
self.replicas[1], setup_ca=True,
nameservers='master' if self.master_with_dns else None)
##
@ -151,10 +165,11 @@ class ADTrustInstallTestBase(IntegrationTest):
##
class TestInstallWithCA1(InstallTestBase1):
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
reason='does not work on DOMAIN_LEVEL_0 by design')
@ -200,10 +215,11 @@ class TestInstallWithCA1(InstallTestBase1):
class TestInstallWithCA2(InstallTestBase2):
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
reason='does not work on DOMAIN_LEVEL_0 by design')
@ -471,27 +487,32 @@ class TestInstallCA(IntegrationTest):
class TestInstallWithCA_KRA1(InstallTestBase1):
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False, setup_kra=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns,
setup_kra=True)
def test_replica0_ipa_kra_install(self):
tasks.install_kra(self.replicas[0], first_instance=False)
class TestInstallWithCA_KRA2(InstallTestBase2):
master_with_dns = False
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=False, setup_kra=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns,
setup_kra=True)
class TestInstallWithCA_DNS1(InstallTestBase1):
master_with_dns = True
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
reason='does not work on DOMAIN_LEVEL_0 by design')
@ -510,10 +531,11 @@ class TestInstallWithCA_DNS1(InstallTestBase1):
class TestInstallWithCA_DNS2(InstallTestBase2):
master_with_dns = True
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns)
@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
reason='does not work on DOMAIN_LEVEL_0 by design')
@ -585,20 +607,24 @@ class TestInstallWithCA_DNS4(CALessBase):
@pytest.mark.cs_acceptance
class TestInstallWithCA_KRA_DNS1(InstallTestBase1):
master_with_dns = True
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=True, setup_kra=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns,
setup_kra=True)
def test_replica0_ipa_kra_install(self):
tasks.install_kra(self.replicas[0], first_instance=False)
class TestInstallWithCA_KRA_DNS2(InstallTestBase2):
master_with_dns = True
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=True, setup_kra=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns,
setup_kra=True)
class TestADTrustInstall(ADTrustInstallTestBase):
@ -616,11 +642,12 @@ class TestADTrustInstallWithDNS_KRA_ADTrust(ADTrustInstallTestBase):
master. Additional two test cases were added to test interplay including
KRA installer
"""
master_with_dns = True
@classmethod
def install(cls, mh):
tasks.install_master(cls.master, setup_dns=True, setup_kra=True,
setup_adtrust=True)
tasks.install_master(cls.master, setup_dns=cls.master_with_dns,
setup_kra=True, setup_adtrust=True)
def test_replica1_all_components_adtrust(self):
self.install_replica(self.replicas[1], setup_ca=True, setup_kra=True)

View File

@ -2201,7 +2201,7 @@ class TestIpaHealthCheckWithExternalCA(IntegrationTest):
tasks.kinit_admin(cls.master)
tasks.install_packages(cls.master, HEALTHCHECK_PKG)
tasks.install_packages(cls.replicas[0], HEALTHCHECK_PKG)
tasks.install_replica(cls.master, cls.replicas[0])
tasks.install_replica(cls.master, cls.replicas[0], nameservers=None)
def test_ipahealthcheck_crlmanagercheck(self):
"""

View File

@ -67,7 +67,8 @@ class TestNTPoptions(IntegrationTest):
assert self.exp_records_msg in server_install.stderr_text
assert self.exp_chrony_msg in server_install.stdout_text
client_install = tasks.install_client(self.master, self.client)
client_install = tasks.install_client(self.master, self.client,
nameservers=None)
assert self.exp_records_msg in client_install.stderr_text
assert self.exp_chrony_msg in client_install.stdout_text
@ -84,7 +85,8 @@ class TestNTPoptions(IntegrationTest):
assert self.exp_default_msg not in server_install.stdout_text
client_install = tasks.install_client(self.master, self.client,
extra_args=['--no-ntp'])
extra_args=['--no-ntp'],
nameservers=None)
assert self.exp_default_msg not in client_install.stdout_text
def test_server_client_install_with_multiple_ntp_srv(self):
@ -104,7 +106,7 @@ class TestNTPoptions(IntegrationTest):
assert self.ntp_server2 in cmd.stdout_text
client_install = tasks.install_client(self.master, self.client,
extra_args=args)
extra_args=args, nameservers=None)
assert self.exp_change_msg in client_install.stderr_text
cmd = self.client.run_command(['cat', paths.CHRONY_CONF])
assert self.ntp_server1 in cmd.stdout_text
@ -127,7 +129,7 @@ class TestNTPoptions(IntegrationTest):
replica_install = tasks.install_replica(self.master, self.replica,
extra_args=args,
promote=False)
promote=False, nameservers=None)
assert self.exp_change_msg in replica_install.stderr_text
cmd = self.replica.run_command(['cat', paths.CHRONY_CONF])
@ -135,7 +137,7 @@ class TestNTPoptions(IntegrationTest):
assert self.ntp_server1 in cmd.stdout_text
client_install = tasks.install_client(self.master, self.client,
extra_args=args)
extra_args=args, nameservers=None)
assert self.exp_change_msg in client_install.stderr_text
cmd = self.client.run_command(['cat', paths.CHRONY_CONF])
assert self.ntp_pool in cmd.stdout_text
@ -156,7 +158,7 @@ class TestNTPoptions(IntegrationTest):
replica_install = tasks.install_replica(self.master, self.replica,
extra_args=args,
promote=True)
promote=True, nameservers=None)
# while promoting with tasks expected_msg will not be in output
assert self.exp_change_msg not in replica_install.stderr_text
@ -164,7 +166,7 @@ class TestNTPoptions(IntegrationTest):
assert self.ntp_server1 in cmd.stdout_text
client_install = tasks.install_client(self.master, self.client,
extra_args=args)
extra_args=args, nameservers=None)
assert self.exp_change_msg in client_install.stderr_text
cmd = self.client.run_command(['cat', paths.CHRONY_CONF])
assert self.ntp_server1 in cmd.stdout_text
@ -199,7 +201,7 @@ class TestNTPoptions(IntegrationTest):
--ntp-pool and -N or --no-ntp option would fail
"""
tasks.install_master(self.master, setup_dns=False)
tasks.install_client(self.master, self.replica)
tasks.install_client(self.master, self.replica, nameservers=None)
replica_install = self.replica.run_command(
['ipa-replica-install', '--no-ntp'],
@ -233,11 +235,12 @@ class TestNTPoptions(IntegrationTest):
assert self.exp_change_msg in server_install.stderr_text
client_install = tasks.install_client(self.master, self.replica,
extra_args=ntp_args)
extra_args=ntp_args,
nameservers=None)
assert self.exp_change_msg in client_install.stderr_text
replica_install = tasks.install_replica(self.master, self.replica,
promote=False)
promote=False, nameservers=None)
assert "ipa-replica-install command was successful" in \
replica_install.stderr_text
@ -302,7 +305,8 @@ class TestNTPoptions(IntegrationTest):
client_install = tasks.install_client(self.master,
self.client,
unattended=False,
stdin_text=client_input)
stdin_text=client_input,
nameservers=None)
assert client_install.returncode == 0
@ -349,7 +353,8 @@ class TestNTPoptions(IntegrationTest):
client_install = tasks.install_client(self.master,
self.client,
unattended=False,
stdin_text=client_input)
stdin_text=client_input,
nameservers=None)
assert client_install.returncode == 0
assert self.exp_records_msg in client_install.stderr_text
@ -389,7 +394,8 @@ class TestNTPoptions(IntegrationTest):
client_install = tasks.install_client(self.master,
self.client,
unattended=False,
stdin_text=client_input)
stdin_text=client_input,
nameservers=None)
assert client_install.returncode == 0
assert self.exp_records_msg in client_install.stderr_text

View File

@ -705,7 +705,8 @@ class TestReplicaInstallCustodia(IntegrationTest):
replica1.run_command(['ipactl', 'status'], raiseonerr=False)
# Install Replica2 with CA with source as Replica1.
tasks.install_replica(replica1, replica2, setup_ca=True)
tasks.install_replica(replica1, replica2, setup_ca=True,
nameservers='master')
result = replica2.run_command(['ipactl', 'status'])
assert 'ipa-custodia Service: RUNNING' in result.stdout_text

View File

@ -37,7 +37,8 @@ class TestUninstallBase(IntegrationTest):
client = self.replicas[0]
client_inv_hostname = '{}.nonexistent'.format(client.hostname)
tasks.install_client(self.master, client,
extra_args=['--hostname', client_inv_hostname])
extra_args=['--hostname', client_inv_hostname],
nameservers=None)
client.run_command(['ipa-client-install', '--uninstall', '-U'])
client_uninstall_log = client.get_file_contents(
@ -57,7 +58,7 @@ class TestUninstallBase(IntegrationTest):
# Include /etc/httpd/conf.d/ipa-rewrite.conf
# from ssl.conf on the replica
tasks.install_replica(self.master, self.replicas[0],
extra_args=['--force-join'])
extra_args=['--force-join'], nameservers=None)
tasks.uninstall_replica(self.master, self.replicas[0])
errline = b'Include /etc/httpd/conf.d/ipa-rewrite.conf'
ssl_conf = self.replicas[0].get_file_contents(paths.HTTPD_SSL_CONF)