예제 #1
0
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),
    )
예제 #2
0
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'
예제 #3
0
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')
예제 #4
0
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')
예제 #5
0
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()
예제 #6
0
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))
예제 #7
0
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=[])
예제 #8
0
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=[])
예제 #9
0
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"""
예제 #10
0
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. """
예제 #11
0
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=[])
    """
예제 #12
0
class EnabledModules(Model):
    """
    DNF modules enabled on the source system.
    """
    topic = SystemFactsTopic

    modules = fields.List(fields.Model(Module), default=[])
예제 #13
0
class KernelCmdline(Model):
    """
    Kernel command line parameters the system was booted with
    """
    topic = SystemInfoTopic

    parameters = fields.List(fields.Model(KernelCmdlineArg))
예제 #14
0
class UsedRepositories(Model):
    """
    Describe list of used repositories in the current system
    """

    topic = SystemInfoTopic

    repositories = fields.List(fields.Model(UsedRepository), default=[])
예제 #15
0
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=[])
예제 #16
0
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())
    """
예제 #17
0
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))
예제 #18
0
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))
예제 #19
0
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))
예제 #20
0
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."""
예제 #21
0
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()
예제 #22
0
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)
예제 #23
0
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"""
예제 #24
0
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=[])
    """
예제 #26
0
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']))
    """
예제 #27
0
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
예제 #28
0
class IfaceResult(Model):
    topic = NetworkInfoTopic
    items = fields.List(fields.Model(IfacesInfo), required=True, default=[])
예제 #29
0
class GroupsFacts(Model):
    topic = SystemFactsTopic

    groups = fields.List(fields.Model(Group))
예제 #30
0
class InstalledRPM(Model):
    topic = SystemInfoTopic
    items = fields.List(fields.Model(RPM), default=[])