Skip to content

Commit

Permalink
ipatests: add a fixture for establishing IPA-AD trust
Browse files Browse the repository at this point in the history
The fixture enables us to setup and cleanup trust between IPA master and
AD root with single line of code. It also handles configuring clients
to be able to accept logins of AD users.
  • Loading branch information
sorlov-rh committed May 19, 2020
1 parent 337ab29 commit ac1f1fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ipatests/pytest_ipa/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,24 @@ def del_compat_attrs(cls):
del cls.ad_subdomains
del cls.ad_treedomains
del cls.ad_domains


@pytest.fixture(scope='class')
def ipa_ad_trust(mh):
ad = mh.ads[0]
tasks.install_adtrust(mh.master)
tasks.configure_dns_for_trust(mh.master, ad)
tasks.establish_trust_with_ad(mh.master, ad.domain.name)
backups = []
for client in mh.clients:
backups.append(tasks.FileBackup(client, paths.KRB5_CONF))
tasks.configure_ipa_client_for_ad_trust(client)
tasks.clear_sssd_cache(client)
yield
for backup in backups:
backup.restore()
for client in mh.clients:
tasks.clear_sssd_cache(client)
tasks.remove_trust_with_ad(mh.master, ad.domain.name)
tasks.unconfigure_dns_for_trust(mh.master, ad)
tasks.clear_sssd_cache(mh.master)

0 comments on commit ac1f1fc

Please sign in to comment.