Imported Upstream version 4.8.10

This commit is contained in:
Mario Fetka
2021-10-03 11:06:28 +02:00
parent 10dfc9587b
commit 03a8170b15
2361 changed files with 1883897 additions and 338759 deletions

View File

@@ -20,26 +20,30 @@
import json
import copy
from ipatests.test_integration import config
from ipatests.pytest_ipa.integration import config
from ipapython.ipautil import write_tmp_file
from ipatests.util import assert_deepequal
from ipalib.constants import MAX_DOMAIN_LEVEL
DEFAULT_OUTPUT_DICT = {
"nis_domain": "ipatest",
"test_dir": "/root/ipatests",
"debug": False,
"ad_admin_name": "Administrator",
"ipv6": False,
"root_ssh_key_filename": "~/.ssh/id_rsa",
"ssh_key_filename": "~/.ssh/id_rsa",
"ssh_username": "root",
"admin_name": "admin",
"ad_admin_password": "Secret123",
"root_password": None,
"ssh_password": None,
"dns_forwarder": "8.8.8.8",
"domains": [],
"dirman_dn": "cn=Directory Manager",
"dirman_password": "Secret123",
"ntp_server": "ntp.clock.test",
"admin_password": "Secret123"
"admin_password": "Secret123",
"domain_level": MAX_DOMAIN_LEVEL,
"log_journal_since": "-1h",
"fips_mode": False,
}
DEFAULT_OUTPUT_ENV = {
@@ -57,6 +61,9 @@ DEFAULT_OUTPUT_ENV = {
"ADADMINPW": "Secret123",
"IPv6SETUP": "",
"IPADEBUG": "",
"DOMAINLVL": str(MAX_DOMAIN_LEVEL),
"LOG_JOURNAL_SINCE": "-1h",
"IPA_FIPS_MODE": "",
}
DEFAULT_INPUT_ENV = {
@@ -77,7 +84,7 @@ def extend_dict(defaults, *others, **kwargs):
return copy.deepcopy(result)
class CheckConfig(object):
class CheckConfig:
def check_config(self, conf):
pass
@@ -129,6 +136,12 @@ class CheckConfig(object):
assert_deepequal(self.get_output_dict(), conf.to_dict())
self.check_config(conf)
# Settings to override:
extra_input_dict = {}
extra_input_env = {}
extra_output_dict = {}
extra_output_env = {}
class TestEmptyConfig(CheckConfig):
extra_input_dict = {}
@@ -141,7 +154,7 @@ class TestMinimalConfig(CheckConfig):
extra_input_dict = dict(
domains=[
dict(name='ipadomain.test', type='IPA', hosts=[
dict(name='master', ip='192.0.2.1'),
dict(name='master', ip='192.0.2.1', host_type=None),
]),
],
)
@@ -160,6 +173,7 @@ class TestMinimalConfig(CheckConfig):
ip="192.0.2.1",
external_hostname="master.ipadomain.test",
role="master",
host_type=None,
),
],
),
@@ -201,24 +215,39 @@ class TestComplexConfig(CheckConfig):
extra_input_dict = dict(
domains=[
dict(name='ipadomain.test', type='IPA', hosts=[
dict(name='master', ip='192.0.2.1', role='master'),
dict(name='replica1', ip='192.0.2.2', role='replica'),
dict(name='master', ip='192.0.2.1', role='master',
host_type=None),
dict(name='replica1', ip='192.0.2.2', role='replica',
host_type=None),
dict(name='replica2', ip='192.0.2.3', role='replica',
external_hostname='r2.ipadomain.test'),
dict(name='client1', ip='192.0.2.4', role='client'),
external_hostname='r2.ipadomain.test', host_type=None),
dict(name='client1', ip='192.0.2.4', role='client',
host_type=None),
dict(name='client2', ip='192.0.2.5', role='client',
external_hostname='c2.ipadomain.test'),
dict(name='extra', ip='192.0.2.6', role='extrarole'),
dict(name='extram1', ip='192.0.2.7', role='extrarolem'),
external_hostname='c2.ipadomain.test', host_type=None),
dict(name='extra', ip='192.0.2.6', role='extrarole',
host_type=None),
dict(name='extram1', ip='192.0.2.7', role='extrarolem',
host_type=None),
dict(name='extram2', ip='192.0.2.8', role='extrarolem',
external_hostname='e2.ipadomain.test'),
external_hostname='e2.ipadomain.test', host_type=None),
]),
dict(name='addomain.test', type='AD', hosts=[
dict(name='ad', ip='192.0.2.33', role='ad'),
dict(name='ad', ip='192.0.2.33', role='ad', host_type=None),
]),
dict(name='ipadomain2.test', type='IPA', hosts=[
dict(name='master.ipadomain2.test', ip='192.0.2.65'),
dict(name='master.ipadomain2.test', ip='192.0.2.65',
host_type=None),
]),
dict(name='adsubdomain.test', type='AD_SUBDOMAIN', hosts=[
dict(name='child_ad', ip='192.0.2.77', role='ad_subdomain',
host_type=None),
]),
dict(name='adtreedomain.test', type='AD_TREEDOMAIN', hosts=[
dict(name='tree_ad', ip='192.0.2.88', role='ad_treedomain',
host_type=None),
]),
],
)
extra_input_env = dict(
@@ -244,6 +273,12 @@ class TestComplexConfig(CheckConfig):
MASTER_env3='master.ipadomain2.test',
BEAKERMASTER1_IP_env3='192.0.2.65',
AD_SUBDOMAIN_env4='child_ad.adsubdomain.test',
BEAKERAD_SUBDOMAIN1_IP_env4='192.0.2.77',
AD_TREEDOMAIN_env5='tree_ad.adtreedomain.test',
BEAKERAD_TREEDOMAIN1_IP_env5='192.0.2.88',
)
extra_output_dict = dict(
domains=[
@@ -256,48 +291,56 @@ class TestComplexConfig(CheckConfig):
ip="192.0.2.1",
external_hostname="master.ipadomain.test",
role="master",
host_type=None,
),
dict(
name='replica1.ipadomain.test',
ip="192.0.2.2",
external_hostname="replica1.ipadomain.test",
role="replica",
host_type=None,
),
dict(
name='replica2.ipadomain.test',
ip="192.0.2.3",
external_hostname="r2.ipadomain.test",
role="replica",
host_type=None,
),
dict(
name='client1.ipadomain.test',
ip="192.0.2.4",
external_hostname="client1.ipadomain.test",
role="client",
host_type=None,
),
dict(
name='client2.ipadomain.test',
ip="192.0.2.5",
external_hostname="c2.ipadomain.test",
role="client",
host_type=None,
),
dict(
name='extra.ipadomain.test',
ip="192.0.2.6",
external_hostname="extra.ipadomain.test",
role="extrarole",
host_type=None,
),
dict(
name='extram1.ipadomain.test',
ip="192.0.2.7",
external_hostname="extram1.ipadomain.test",
role="extrarolem",
host_type=None,
),
dict(
name='extram2.ipadomain.test',
ip="192.0.2.8",
external_hostname="e2.ipadomain.test",
role="extrarolem",
host_type=None,
),
],
),
@@ -310,6 +353,7 @@ class TestComplexConfig(CheckConfig):
ip="192.0.2.33",
external_hostname="ad.addomain.test",
role="ad",
host_type=None,
),
],
),
@@ -322,12 +366,41 @@ class TestComplexConfig(CheckConfig):
ip="192.0.2.65",
external_hostname="master.ipadomain2.test",
role="master",
host_type=None,
),
],
),
dict(
type="AD_SUBDOMAIN",
name="adsubdomain.test",
hosts=[
dict(
name='child_ad.adsubdomain.test',
ip="192.0.2.77",
external_hostname="child_ad.adsubdomain.test",
role="ad_subdomain",
host_type=None,
),
],
),
dict(
type="AD_TREEDOMAIN",
name="adtreedomain.test",
hosts=[
dict(
name='tree_ad.adtreedomain.test',
ip="192.0.2.88",
external_hostname="tree_ad.adtreedomain.test",
role="ad_treedomain",
host_type=None,
),
],
),
],
)
extra_output_env = extend_dict(extra_input_env,
extra_output_env = extend_dict(
extra_input_env,
DOMAIN_env1="ipadomain.test",
RELM_env1="IPADOMAIN.TEST",
BASEDN_env1="dc=ipadomain,dc=test",
@@ -406,12 +479,32 @@ class TestComplexConfig(CheckConfig):
MASTER1_env3="master.ipadomain2.test",
BEAKERMASTER1_env3="master.ipadomain2.test",
BEAKERMASTER1_IP_env3="192.0.2.65",
DOMAIN_env4="adsubdomain.test",
RELM_env4="ADSUBDOMAIN.TEST",
AD_SUBDOMAIN_env4='child_ad.adsubdomain.test',
AD_SUBDOMAIN1_env4='child_ad.adsubdomain.test',
BEAKERAD_SUBDOMAIN1_IP_env4='192.0.2.77',
BEAKERAD_SUBDOMAIN1_env4='child_ad.adsubdomain.test',
BEAKERAD_SUBDOMAIN_IP_env4='192.0.2.77',
BEAKERAD_SUBDOMAIN_env4='child_ad.adsubdomain.test',
BASEDN_env4='dc=adsubdomain,dc=test',
DOMAIN_env5="adtreedomain.test",
RELM_env5="ADTREEDOMAIN.TEST",
AD_TREEDOMAIN_env5='tree_ad.adtreedomain.test',
AD_TREEDOMAIN1_env5='tree_ad.adtreedomain.test',
BEAKERAD_TREEDOMAIN1_IP_env5='192.0.2.88',
BEAKERAD_TREEDOMAIN1_env5='tree_ad.adtreedomain.test',
BEAKERAD_TREEDOMAIN_IP_env5='192.0.2.88',
BEAKERAD_TREEDOMAIN_env5='tree_ad.adtreedomain.test',
BASEDN_env5='dc=adtreedomain,dc=test',
)
def check_config(self, conf):
assert len(conf.domains) == 3
assert len(conf.domains) == 5
main_dom = conf.domains[0]
(client1, client2, extra, extram1, extram2, master,
(client1, client2, extra, extram1, extram2, _master,
replica1, replica2) = sorted(main_dom.hosts, key=lambda h: h.role)
assert main_dom.name == 'ipadomain.test'
assert main_dom.type == 'IPA'
@@ -435,3 +528,13 @@ class TestComplexConfig(CheckConfig):
assert ad_dom.roles == ['ad']
assert ad_dom.static_roles == ('ad',)
assert ad_dom.extra_roles == []
ad_sub_domain = conf.domains[3]
assert ad_sub_domain.roles == ['ad_subdomain']
assert ad_sub_domain.static_roles == ('ad_subdomain',)
assert ad_sub_domain.extra_roles == []
ad_tree_domain = conf.domains[4]
assert ad_tree_domain.roles == ['ad_treedomain']
assert ad_tree_domain.static_roles == ('ad_treedomain',)
assert ad_tree_domain.extra_roles == []