sssd_test_framework.hosts.base
Base classes and objects for SSSD specific multihost hosts.
Classes
|
Base class for all domain (backend) hosts. |
|
Base class for all SSSD hosts. |
|
Base class for all domain (backend) hosts that require direct LDAP access to manipulate data (like 389ds or SambaDC). |
|
Base Linux host. |
- class sssd_test_framework.hosts.base.BaseHost(*args, **kwargs)
Bases:
MultihostBackupHost[SSSDMultihostDomain]Base class for all SSSD hosts.
- Parameters:
auto_start – Automatically start service before taking the first backup.
auto_restore (bool, optional) – If True, the host is automatically restored to the backup state when a test is finished in
teardown(), defaults to True
- property features: dict[str, bool]
Features supported by the host.
- class sssd_test_framework.hosts.base.BaseDomainHost(*args, **kwargs)
Bases:
BaseHostBase class for all domain (backend) hosts.
This class extends the multihost configuration with
config.clientsection that can contain additional SSSD configuration for the domain to allow connection to the domain (like keytab and certificate locations, domain name, etc.).Example multihost configuration- hostname: master.ipa.test role: ipa config: client: ipa_domain: ipa.test krb5_keytab: /enrollment/ipa.keytab ldap_krb5_keytab: /enrollment/ipa.keytab
- Parameters:
auto_start – Automatically start service before taking the first backup.
auto_restore (bool, optional) – If True, the host is automatically restored to the backup state when a test is finished in
teardown(), defaults to True
- client: dict[str, Any]
- domain: str
Identity domain name.
- realm: str
Kerberos realm.
- class sssd_test_framework.hosts.base.BaseLDAPDomainHost(*args, **kwargs)
Bases:
BaseDomainHostBase class for all domain (backend) hosts that require direct LDAP access to manipulate data (like 389ds or SambaDC).
Extends
BaseDomainHostto manage LDAP connection and addsconfig.binddnandconfig.bindpwmultihost configuration options.Example multihost configuration- hostname: master.ldap.test role: ldap config: binddn: cn=Directory Manager bindpw: Secret123 client: ldap_tls_reqcert: demand ldap_tls_cacert: /data/certs/ca.crt dns_discovery_domain: ldap.test
Note
The LDAP connection is not opened immediately, but only when
connis accessed for the first time.- Parameters:
tls (bool, optional) – Require TLS connection, defaults to True
- tls: bool
Use TLS when establishing connection or no?
- binddn: str
Bind DN
config.binddn, defaults tocn=Directory Manager
- bindpw: str
Bind password
config.bindpw, defaults toSecret123
- property ldap_conn: ReconnectLDAPObject
LDAP connection (
python-ldaplibrary).- Return type:
ReconnectLDAPObject
- property naming_context: str
Default naming context.
- Raises:
ValueError – If default naming context can not be obtained.
- Return type:
str
- disconnect() None
Disconnect LDAP connection.
- ldap_result_to_dict(result: list[tuple[str, dict[str, list[bytes]]]]) dict[str, dict[str, list[bytes]]]
Convert result from python-ldap library from tuple into a dictionary to simplify lookup by distinguished name.
- Parameters:
result (tuple[str, dict[str, list[bytes]]]) – Search result from python-ldap.
- Returns:
Dictionary with distinguished name as key and attributes as value.
- Return type:
dict[str, dict[str, list[bytes]]]
- class sssd_test_framework.hosts.base.BaseLinuxHost(*args, **kwargs)
Bases:
MultihostHost[SSSDMultihostDomain]Base Linux host.
Adds linux specific reentrant utilities.
- Parameters:
domain (DomainType) – Multihost domain object.
confdict (dict[str, Any]) – Host configuration as a dictionary.
- fs: LinuxFileSystem
- svc: SystemdServices
- property distro_name: str
Host distribution
- Returns:
Distribution name or “unknown”
- Return type:
str
- property distro_major: int
Host distribution major version
- Returns:
Major version
- Return type:
int
- property distro_minor: int
Host distribution minor version
- Returns:
Minor version
- Return type:
int
- get_package_version(package: str = 'sssd', raise_on_error: bool = True) dict
Parse package version and return it as a dictionary with: major, minor, patch, prerelease, update, release
- Parameters:
package – package name
raise_on_error – raise exeption when package is missing
- Returns:
version dictionary
- Return type:
dict
- Raises:
OSError – If package is missing or version could not be parsed.
- compare_package_version(other_version: dict, package: str = 'sssd') int
Compare installed package version with other version.
- Parameters:
other_version – Version dictionary to compare keys: major, minor, patch, prerelease, update, release
package – Package name (default: sssd)
- Returns:
-1 if installed < other, 0 if equal, 1 if installed > other
- selinux_permissive_for_test() Generator[None, None, None]
Temporarily set SELinux to permissive for tests.