qe_class.py revision b6ece28856aa36dba6304dca4bac57f552ff0a6a
from pytest_multihost import make_multihost_fixture
import pytest_multihost.config
import pytest_multihost.host
import logging
import pytest
import time
"""QeConfig subclass of multihost plugin to extend functionality."""
'rootdn', 'rootdn_pwd'}
def get_domain_class(self):
"""return custom domain class.
This is needed to fully extend the config for custom
multihost plugin extensions.
Args:
None
Returns:
None
"""
return QeDomain
"""Override get_logger to set logging level.
Args:
name (str): Name of the logger
Returns:
log (obj): Logger object
"""
# set log Level
# set formatter
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
return log
"""QeBaseHost subclass of multihost plugin BaseHost class."""
pass
class QeHost(QeBaseHost):
"""QeHost subclass of multihost plugin host class.
This extends functionality of the host class for SSSD QE purposes.
Here we add support functions that will be very widely used across
tests and must be run on any or all hosts in the environment.
"""
def sys_hostname(self):
"""Get system hostname
Args:
None
Returns:
str: System hostname
"""
""" Get contents of /etc/redhat-release
:param None:
:return str: contents of /etc/redhat-release
"""
distro = 'Unknown Distro'
else:
return distro
:Exception Raises exception
"""
return cmd.returncode
else:
return cmd.returncode
else:
return cmd.returncode
else:
return cmd.returncode
else:
""" Install packages through yum
:param str package: Name of the package to be installed
:return str: Returncode of the yum command
:Exception: None
"""
return cmd.returncode
""" Install packages through dnf
:param str package: Name of the package to be installed
:return str: Returncode of the dnf command
:Exception: None
"""
return cmd.returncode
""" Uninstall packages through yum
:param str package: Name of the package to be uninstalled
:return str: Return code of the yum remove command
:Exception: None
"""
return cmd.returncode
""" Uninstall packages through dnf
:param str package: Name of the package to be uninstalled
:return str: Return code of the dnf remove command
:Exception: None
"""
return cmd.returncode
""" Windows Host class
Subclass of pytest_multihost.host.WinHost, QeBaseHost
Functions defined provide extra attributes when using Windows AD
Attributes:
domainname (str): Return domainname of the AD Machine
realm (str): Return AD realm in upper case
"""
def domainname(self):
""" Return Domain name """
""" Return AD Realm """
def domain_basedn_entry(self):
""" Return base DN Entry of the """
split('.')]
return domain_base_dn
""" Return DN entry of client computer in AD """
return output
""" Return DN entry of client computer in AD """
return output
""" QeDomain subclass of multihost plugin domain class. """
"""
Subclass of pytest_multihost.config.Domain
:param obj config: config config
:param str name: Name
:param str domain_type:
:return None:
"""
def session_multihost(request):
"""Multihost plugin fixture for session scope"""
{
'type': 'sssd',
'hosts':
{
}
},
{
'type': 'ad',
'hosts':
{
},
},
], config_class=QeConfig,)
else:
{
'type': 'sssd',
'hosts':
{
}
},
], config_class=QeConfig,)
yield mh
def remove_test_dir():