class RestrictedPCIDevices(Model): """ Model to represent all known restricted PCI devices. Restricted devices might be restricted based on either - pci id (each particular device) - driver name (all the family of the devices being served by the particular driver). However the data type, which represents how the pci id or driver name is restricted is identical. Thus both attributes has the same data type. driver_names - is a container with the devices, which are restricted by the driver name identifier pci_ids - is a container with the devices, which are restricted by the pci_id identifier """ topic = SystemInfoTopic driver_names = fields.List( fields.Model(RestrictedPCIDevice), ) pci_ids = fields.List( fields.Model(RestrictedPCIDevice), )
def test_nested_model(): m = WithNestedModel(basic=BasicModel(message='Some message')) m2 = WithNestedModel.create(m.dump()) assert m.basic == m2.basic with pytest.raises(fields.ModelMisuseError): fields.Model(fields.String()) with pytest.raises(fields.ModelMisuseError): fields.Model(fields.String) with pytest.raises(fields.ModelViolationError): WithNestedModel(basic='Some message') m = WithNullableNestedModel() m.basic = None m.dump() with pytest.raises(fields.ModelViolationError): x = WithNestedModel(basic=BasicModel(message='Some message')) x.basic = None x.dump() with pytest.raises(fields.ModelViolationError): WithNestedModel.create(dict(basic=None)) with pytest.raises(fields.ModelViolationError): WithNestedModel(basic=None) assert WithNestedModel.create({'basic': {'message': 'test-message'}}).basic.message == 'test-message' assert WithNestedModel(basic=BasicModel(message='test-message')).basic.message == 'test-message'
def test_nested_field(): with pytest.raises(fields.ModelViolationError): fields.Model(BasicModel)._convert_to_model('something', 'test-value') with pytest.raises(fields.ModelViolationError): fields.Model(BasicModel)._convert_to_model(None, 'test-value') fields.Nullable(fields.Model(BasicModel))._convert_to_model( None, 'test-value')
def test_nested_field(): with pytest.raises(fields.ModelViolationError): fields.Model(BasicModel, allow_null=False)._convert_to_model( 'something', 'test-value') with pytest.raises(fields.ModelViolationError): fields.Model(BasicModel, allow_null=False)._convert_to_model(None, 'test-value') fields.Model(BasicModel, allow_null=True)._convert_to_model(None, 'test-value')
class IPUConfig(Model): """ IPU workflow configuration model """ topic = SystemInfoTopic leapp_env_vars = fields.List(fields.Model(EnvVar), default=[]) os_release = fields.Model(OSRelease) version = fields.Model(Version) architecture = fields.String()
class SELinuxModules(Model): """ List of selinux modules that are not part of distribution policy modules - list of custom policy modules (priority != 100,200) templates - List of installed udica templates """ topic = SystemInfoTopic modules = fields.List(fields.Model(SELinuxModule)) templates = fields.List(fields.Model(SELinuxModule))
class RpmTransactionTasks(Model): topic = TransactionTopic local_rpms = fields.List(fields.String(), default=[]) to_install = fields.List(fields.String(), default=[]) to_keep = fields.List(fields.String(), default=[]) to_remove = fields.List(fields.String(), default=[]) to_upgrade = fields.List(fields.String(), default=[]) modules_to_enable = fields.List(fields.Model(Module), default=[]) modules_to_reset = fields.List(fields.Model(Module), default=[])
class RepositoriesMapping(Model): """ Private model containing information about mapping between repositories. Warning: We expect to be only consumers of this model. This means the model is not covered by deprecation process and can be changed or removed any time. """ topic = TransactionTopic mapping = fields.List(fields.Model(RepoMapEntry), default=[]) repositories = fields.List(fields.Model(PESIDRepositoryEntry), default=[])
class VsftpdFacts(Model): topic = SystemInfoTopic default_config_hash = fields.Nullable(fields.String()) """SHA1 hash of the /etc/vsftpd/vsftpd.conf file, if it exists, None otherwise""" configs = fields.List(fields.Model(VsftpdConfig)) """List of vsftpd configuration files"""
class OpenSshConfig(Model): """ OpenSSH server configuration. This model contains the first effective configuration option specified in the configuration file or a list of all the options specified in all the conditional blocks used throughout the file. """ topic = SystemInfoTopic permit_root_login = fields.List(fields.Model(OpenSshPermitRootLogin)) """ All PermitRootLogin directives. """ use_privilege_separation = fields.Nullable(fields.StringEnum(['sandbox', 'yes', 'no'])) """ Value of the UsePrivilegeSeparation directive, if present. Removed in RHEL 8. """ protocol = fields.Nullable(fields.String()) """ Value of the Protocols directive, if present. Removed in RHEL 8. """ ciphers = fields.Nullable(fields.String()) """ Value of the Ciphers directive, if present. Ciphers separated by comma. """ macs = fields.Nullable(fields.String()) """ Value of the MACs directive, if present. """ modified = fields.Boolean(default=False) """ True if the configuration file was modified. """ deprecated_directives = fields.List(fields.String()) """ Configuration directives that were deprecated in the new version of openssh. """
class UpgradeInitramfsTasks(Model): """ Influence generating of the (leapp) upgrade initramfs The upgrade initramfs is used during the crucial part of the upgrade, in which the original rpms are upgraded, configuration of applications are migrated, etc. To be able to boot into the leapp upgrade environment correctly, it is expected all needed drivers, configuration files, ... are included inside the upgrade initramfs. Produce this message with expected content to influence the upgrade initramfs. If some specific rpms or content is required to be able to build the upgrade initramfs, see the <container-model>. Note: The built initramfs is composed of stuff for the target system. In example, if you are on RHEL 7 and plan the upgrade to RHEL 8, you need to provide content (e.g. drivers, dracut modules) compatible with RHEL 8 system. """ topic = BootPrepTopic include_files = fields.List(fields.String(), default=[]) """ List of files (cannonical filesystem paths) to include in the initramfs """ include_dracut_modules = fields.List(fields.Model(DracutModule), default=[]) """
class EnabledModules(Model): """ DNF modules enabled on the source system. """ topic = SystemFactsTopic modules = fields.List(fields.Model(Module), default=[])
class KernelCmdline(Model): """ Kernel command line parameters the system was booted with """ topic = SystemInfoTopic parameters = fields.List(fields.Model(KernelCmdlineArg))
class UsedRepositories(Model): """ Describe list of used repositories in the current system """ topic = SystemInfoTopic repositories = fields.List(fields.Model(UsedRepository), default=[])
class StorageInfo(Model): topic = SystemInfoTopic partitions = fields.List(fields.Model(PartitionEntry), default=[]) fstab = fields.List(fields.Model(FstabEntry), default=[]) mount = fields.List(fields.Model(MountEntry), default=[]) lsblk = fields.List(fields.Model(LsblkEntry), default=[]) pvs = fields.List(fields.Model(PvsEntry), default=[]) vgs = fields.List(fields.Model(VgsEntry), default=[]) lvdisplay = fields.List(fields.Model(LvdisplayEntry), default=[]) systemdmount = fields.List(fields.Model(SystemdMountEntry), default=[])
class SSSDConfig(Model): """ List of SSSD domains and their configuration that is related to the upgrade process. """ topic = SystemInfoTopic domains = fields.List(fields.Model(SSSDDomainConfig), default=list()) """
class TcpWrappersFacts(Model): """ A representation of tcp_wrappers configuration. Currently it only contains a list of daemon lists that are present in the tcp_wrappers configuration files. From this you can extract information on whether there is any configuration that applies to a specific daemon (see leapp.libraries.common.tcpwrappersutils.config_applies_to_daemon()). """ topic = SystemInfoTopic daemon_lists = fields.List(fields.Model(DaemonList))
class RenamedInterfaces(Model): """ Provide list of renamed network interfaces These interfaces will use different names on the target system in comparison with original names. """ topic = SystemInfoTopic renamed = fields.List(fields.Model(RenamedInterface))
class PamConfiguration(Model): """ Global PAM configuration This model describes separate services using PAM and what pam modules are used in each of them. Consumer can select just the pam services he is interested in or scan for specific configuration throughout all the services. """ topic = SystemInfoTopic services = fields.List(fields.Model(PamService))
class IPUConfig(Model): """ IPU workflow configuration model """ topic = SystemInfoTopic leapp_env_vars = fields.List(fields.Model(EnvVar), default=[]) """Environment variables related to the leapp.""" os_release = fields.Model(OSRelease) """Data about the OS get from /etc/os-release.""" version = fields.Model(Version) """Version of the current (source) system and expected target system.""" architecture = fields.String() """Architecture of the system. E.g.: 'x86_64'.""" kernel = fields.String() """Originally booted kernel when on the source system."""
class Interface(Model): """ TODO: tbd - Interface or NetworkInterface? """ topic = SystemInfoTopic name = fields.String() devpath = fields.String() driver = fields.String() vendor = fields.String() pci_info = fields.Model(PCIAddress) mac = fields.String()
class SystemFacts(Model): topic = SystemInfoTopic sysctl_variables = fields.List(fields.Model(SysctlVariable)) kernel_modules = fields.List(fields.Model(ActiveKernelModule)) users = fields.List(fields.Model(User)) groups = fields.List(fields.Model(Group)) repositories = fields.List(fields.Model(Repositories)) selinux = fields.Model(SELinux) firewalls = fields.Model(Firewalls)
class IPUConfig(Model): """ IPU workflow configuration model """ topic = SystemInfoTopic leapp_env_vars = fields.List(fields.Model(EnvVar), default=[]) """Environment variables related to the leapp.""" os_release = fields.Model(OSRelease) """Data about the OS get from /etc/os-release.""" version = fields.Model(Version) """Version of the current (source) system and expected target system.""" architecture = fields.String() """Architecture of the system. E.g.: 'x86_64'.""" kernel = fields.String() """Originally booted kernel when on the source system.""" flavour = fields.StringEnum(('default', 'saphana'), default='default') """Flavour of the upgrade - Used to influence changes in supported source/target release"""
class OpenSshConfig(Model): """ OpenSSH server configuration. This model contains the first effective configuration option specified in the configuration file or a list of all the options specified in all the conditional blocks used throughout the file. """ topic = SystemInfoTopic permit_root_login = fields.List(fields.Model(OpenSshPermitRootLogin)) use_privilege_separation = fields.Nullable(fields.StringEnum(['sandbox', 'yes', 'no'])) protocol = fields.Nullable(fields.String()) ciphers = fields.Nullable(fields.String()) macs = fields.Nullable(fields.String()) modified = fields.Nullable(fields.Boolean())
class TargetUserSpacePreupgradeTasks(Model): """ Influence content of the target userspace container See the TargetUserSpaceInfo model description for more info about the target userspace container. """ topic = TransactionTopic copy_files = fields.List(fields.Model(CopyFile), default=[]) """ List of files on the host that should be copied into the container Directories are supported as well. If a file/dir already exists on the destination path, it is removed & replaced. """ install_rpms = fields.List(fields.String(), default=[]) """
class Report(Model): """ Framework model used for reporting and presentation (see "renderers" field) purposes. The report can also carry a special meaning using "flags" field. """ __non_inheritable__ = True topic = ReportTopic severity = fields.StringEnum(choices=['low', 'medium', 'high']) """ Severity of the report entry """ title = fields.String() """ Title of the report entry """ detail = fields.JSON() """ Detail of the report entry as JSON data """ renderers = fields.Model(Renderers) """ :class:`Renderers` describe how to render this report entry """ audience = fields.List( fields.StringEnum(choices=['developer', 'sysadmin'])) """ Who is the main audience of this report entry """ flags = fields.List(fields.StringEnum(choices=['inhibitor'])) """
class MultipathConfig(Model): """Model representing information about a multipath configuration file""" topic = SystemInfoTopic pathname = fields.String() """Config file path name""" default_path_checker = fields.Nullable(fields.String()) config_dir = fields.Nullable(fields.String()) """Values of path_checker and config_dir in the defaults section. None if not set""" default_retain_hwhandler = fields.Nullable(fields.Boolean()) default_detect_prio = fields.Nullable(fields.Boolean()) default_detect_checker = fields.Nullable(fields.Boolean()) reassign_maps = fields.Nullable(fields.Boolean()) """True if retain_attached_hw_handler, detect_prio, detect_path_checker, or reassign_maps is set to "yes" in the defaults section. False if set to "no". None if not set.""" hw_str_match_exists = fields.Boolean(default=False) ignore_new_boot_devs_exists = fields.Boolean(default=False) new_bindings_in_boot_exists = fields.Boolean(default=False) unpriv_sgio_exists = fields.Boolean(default=False) detect_path_checker_exists = fields.Boolean(default=False) overrides_hwhandler_exists = fields.Boolean(default=False) overrides_pg_timeout_exists = fields.Boolean(default=False) queue_if_no_path_exists = fields.Boolean(default=False) all_devs_section_exists = fields.Boolean(default=False) """True if hw_str_match, ignore_new_boot_devs, new_bindings_in_boot, detect_path_checker, or unpriv_sgio is set in any section, if queue_if_no_path is included in the features line in any section or if hardware_handler or pg_timeout is set in the overrides section. False otherwise""" all_devs_options = fields.List(fields.Model(MultipathConfigOption), default=[]) """options in an all_devs device configuration section to be converted to
class IfaceResult(Model): topic = NetworkInfoTopic items = fields.List(fields.Model(IfacesInfo), required=True, default=[])
class GroupsFacts(Model): topic = SystemFactsTopic groups = fields.List(fields.Model(Group))
class InstalledRPM(Model): topic = SystemInfoTopic items = fields.List(fields.Model(RPM), default=[])