def cleanup(self): nfssrv = self.clients[0] nfsclt = self.replicas[0] automntclt = self.replicas[1] nfsclt.run_command(["umount", "-a", "-t", "nfs4"]) nfsclt.run_command(["systemctl", "stop", "rpc-gssd"]) nfssrv.run_command(["systemctl", "stop", "nfs-server"]) nfssrv.run_command(["systemctl", "disable", "nfs-server"]) nfssrv.run_command([ "rm", "-f", "/etc/exports.d/krbnfs.exports", "/etc/exports.d/stdnfs.exports" ]) nfssrv.run_command(["rm", "-rf", "/exports"]) tasks.uninstall_client(nfsclt) tasks.uninstall_client(nfssrv) self.master.run_command( ["ipa", "host-mod", automntclt.hostname, "--location", "''"]) # not strictly necessary, but this exercises automountlocation-del self.master.run_command(["ipa", "automountlocation-del", "seattle"]) nfsclt.run_command(["systemctl", "restart", "nfs-utils"]) nfssrv.run_command(["systemctl", "restart", "nfs-utils"]) for client in (nfssrv, nfsclt, automntclt): self.restore_resolv_conf(client) tasks.uninstall_master(self.master)
def fin(): """ Uninstall ipa-server, ipa-replica and ipa-client """ tasks.uninstall_client(self.client) tasks.uninstall_master(self.replica) tasks.uninstall_master(self.master)
def cleanup(self): nfssrv = self.clients[0] nfsclt = self.replicas[0] automntclt = self.replicas[1] nfsclt.run_command(["umount", "-a", "-t", "nfs4"]) nfsclt.run_command(["systemctl", "stop", "rpc-gssd"]) nfssrv.run_command(["systemctl", "stop", "nfs-server"]) nfssrv.run_command(["systemctl", "disable", "nfs-server"]) nfssrv.run_command([ "rm", "-f", "/etc/exports.d/krbnfs.exports", "/etc/exports.d/stdnfs.exports" ]) nfssrv.run_command(["rm", "-rf", "/exports"]) tasks.uninstall_client(nfsclt) tasks.uninstall_client(nfssrv) self.master.run_command([ "ipa", "host-mod", automntclt.hostname, "--location", "''" ]) # not strictly necessary, but this exercises automountlocation-del self.master.run_command([ "ipa", "automountlocation-del", "seattle" ]) nfsclt.run_command(["systemctl", "restart", "nfs-utils"]) nfssrv.run_command(["systemctl", "restart", "nfs-utils"]) for client in (nfssrv, nfsclt, automntclt): self.restore_resolv_conf(client) tasks.uninstall_master(self.master)
def teardown_method(self, method): """ Uninstall ipa-server, ipa-replica and ipa-client """ tasks.uninstall_client(self.client) tasks.uninstall_master(self.replica) tasks.uninstall_master(self.master)
def nsswitch_backup_restore( self, no_sssd=False, ): # In order to get a more pure sum, one that ignores the Generated # header and any white space we have to do a bit of work... sha256nsswitch_cmd = \ 'egrep -v "Generated|^$" /etc/nsswitch.conf | sed "s/\\s//g" ' \ '| sort | sha256sum' cmd = self.clients[0].run_command(sha256nsswitch_cmd) orig_sha256 = cmd.stdout_text grep_automount_command = \ "grep automount /etc/nsswitch.conf | cut -d: -f2" tasks.install_client(self.master, self.clients[0]) cmd = self.clients[0].run_command(grep_automount_command) after_ipa_client_install = cmd.stdout_text.split() if no_sssd: ipa_client_automount_command = [ "ipa-client-automount", "--no-sssd", "-U" ] else: ipa_client_automount_command = ["ipa-client-automount", "-U"] self.clients[0].run_command(ipa_client_automount_command) cmd = self.clients[0].run_command(grep_automount_command) after_ipa_client_automount = cmd.stdout_text.split() if no_sssd: assert after_ipa_client_automount == ['files', 'ldap'] else: assert after_ipa_client_automount == ['sss', 'files'] cmd = self.clients[0].run_command(grep_automount_command) assert cmd.stdout_text.split() == after_ipa_client_automount self.clients[0].run_command( ["ipa-client-automount", "--uninstall", "-U"]) if not no_sssd: # https://pagure.io/freeipa/issue/8190 # check that no ipa_automount_location is left in sssd.conf # also check for autofs_provider for good measure grep_automount_in_sssdconf_cmd = \ "egrep ipa_automount_location\\|autofs_provider " \ "/etc/sssd/sssd.conf" cmd = self.clients[0].run_command(grep_automount_in_sssdconf_cmd, raiseonerr=False) assert cmd.returncode == 1, \ "PG8190 regression found: ipa_automount_location still " \ "present in sssd.conf" cmd = self.clients[0].run_command(grep_automount_command) assert cmd.stdout_text.split() == after_ipa_client_install tasks.uninstall_client(self.clients[0]) cmd = self.clients[0].run_command(sha256nsswitch_cmd) assert cmd.stdout_text == orig_sha256
def teardown_method(self, method): """ Uninstall ipa-server, ipa-replica and ipa-client """ tasks.uninstall_client(self.client) tasks.uninstall_master(self.replica) tasks.uninstall_master(self.master)
def verify_checksum_after_ipaclient_uninstall( self, sha256nsswitch_cmd, orig_sha256 ): tasks.uninstall_client(self.clients[0]) cmd = self.clients[0].run_command(sha256nsswitch_cmd) assert cmd.stdout_text == orig_sha256
def nsswitch_backup_restore( self, no_sssd=False, ): # In order to get a more pure sum, one that ignores the Generated # header and any white space we have to do a bit of work... sha256nsswitch_cmd = \ 'egrep -v "Generated|^$" /etc/nsswitch.conf | sed "s/\\s//g" ' \ '| sort | sha256sum' cmd = self.clients[0].run_command(sha256nsswitch_cmd) orig_sha256 = cmd.stdout_text grep_automount_command = \ "grep automount /etc/nsswitch.conf | cut -d: -f2" tasks.install_client(self.master, self.clients[0]) cmd = self.clients[0].run_command(grep_automount_command) after_ipa_client_install = cmd.stdout_text.split() if no_sssd: ipa_client_automount_command = [ "ipa-client-automount", "--no-sssd", "-U" ] else: ipa_client_automount_command = ["ipa-client-automount", "-U"] self.clients[0].run_command(ipa_client_automount_command) cmd = self.clients[0].run_command(grep_automount_command) after_ipa_client_automount = cmd.stdout_text.split() if no_sssd: assert after_ipa_client_automount == ['files', 'ldap'] else: assert after_ipa_client_automount == ['sss', 'files'] cmd = self.clients[0].run_command(grep_automount_command) assert cmd.stdout_text.split() == after_ipa_client_automount self.clients[0].run_command( ["ipa-client-automount", "--uninstall", "-U"]) cmd = self.clients[0].run_command(grep_automount_command) assert cmd.stdout_text.split() == after_ipa_client_install tasks.uninstall_client(self.clients[0]) cmd = self.clients[0].run_command(sha256nsswitch_cmd) assert cmd.stdout_text == orig_sha256
def uninstall(cls, mh): for replica in cls.replicas: try: tasks.run_server_del(cls.master, replica.hostname, force=True, ignore_topology_disconnect=True, ignore_last_of_role=True) except subprocess.CalledProcessError: # If the master has already been uninstalled, # this call may fail pass tasks.uninstall_master(replica) tasks.uninstall_master(cls.master) for client in cls.clients: tasks.uninstall_client(client) if cls.fips_mode: cls.disable_fips_mode()
def teardown_client(): tasks.uninstall_client(request.cls.clients[0]) request.cls.delete_client_host_entry()
def test_dns_lookup_kdc_is_true_with_ipa_server_on_cli(self): tasks.install_client(self.master, self.clients[0], extra_args=["--server", self.master.hostname]) self.check_dns_lookup_kdc(self.clients[0]) tasks.uninstall_client(self.clients[0])
def test_dns_lookup_kdc_is_true_with_default_enrollment_options(self): self.check_dns_lookup_kdc(self.clients[0]) tasks.uninstall_client(self.clients[0])
def uninstall(cls, mh): for client in cls.clients + cls.replicas: tasks.uninstall_client(client) cls.restore_resolv_conf(client) tasks.uninstall_master(cls.master)
def cleanup(self): """ Uninstall ipa-server and ipa-client """ tasks.uninstall_client(self.client) tasks.uninstall_master(self.master)
def uninstall(cls, mh): tasks.uninstall_master(cls.master) for replica in cls.replicas: tasks.uninstall_master(replica) for client in cls.clients: tasks.uninstall_client(client)
def teardown_method(self, method): tasks.uninstall_client(self.clients[0])
def uninstall(cls, mh): tasks.uninstall_master(cls.master) for replica in cls.replicas: tasks.uninstall_master(replica) for client in cls.clients: tasks.uninstall_client(client)
def fin(): tasks.uninstall_client(self.clients[0])
def teardown_client(): tasks.uninstall_client(request.cls.clients[0]) request.cls.delete_client_host_entry()