Пример #1
0
class FirewalldFacts(Model):
    """The model contains firewalld configuration."""
    topic = SystemInfoTopic

    firewall_config_command = fields.String(default='')
    ebtablesTablesInUse = fields.List(fields.String(), default=[])
    ipsetTypesInUse = fields.List(fields.String(), default=[])
Пример #2
0
class RestrictedPCIDevice(Model):
    """
    Model to represent known restrictions of the given PCI devices.


    pci_id - unsupported pci_ids. It has the following
        structure: {Vendor}:{Device}:{SVendor}:{SDevice}, where all these 4
        parameters are numeric ids (see shell command spci -vmmkn). If SVendor
        and SDevice fields do not exist, then pci_id has the following structure:
        {Vendor}:{Device}.
    driver_name - the name of restricted driver
    device_name - the name of restricted device
    supported_{rhel_version} - 1 is supported on the given RHEL, 0 - not
        supported
    available_{rhel_version} - 1 is available on the given RHEL, 0 - not
        available. it could be the driver is available, but not supported
    comments - the field for comments
    """
    topic = SystemInfoTopic

    pci_id = fields.Nullable(fields.String())
    driver_name = fields.Nullable(fields.String())
    device_name = fields.Nullable(fields.String())
    available_rhel7 = fields.Integer()
    supported_rhel7 = fields.Integer()
    available_rhel8 = fields.Integer()
    supported_rhel8 = fields.Integer()
    available_rhel9 = fields.Integer()
    supported_rhel9 = fields.Integer()
    comment = fields.Nullable(fields.String())
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=[])
Пример #4
0
class RootSubdirectory(Model):
    """
    Representation of a single root subdirectory. Can be expanded as needed.
    """
    topic = SystemFactsTopic
    name = fields.String()
    target = fields.Nullable(fields.String())  # if it's a link
Пример #5
0
class RPM(Model):
    topic = SystemInfoTopic
    name = fields.String(required=True)
    epoch = fields.String(required=True)
    version = fields.String(required=True)
    release = fields.String(required=True)
    arch = fields.String(required=True)
Пример #6
0
class PartitionEntry(Model):
    topic = SystemInfoTopic

    major = fields.String()
    minor = fields.String()
    blocks = fields.String()
    name = fields.String()
Пример #7
0
class Module(Model):
    """
    A single DNF module indentified by its name and stream.
    """
    topic = SystemFactsTopic
    name = fields.String()
    stream = fields.String()
Пример #8
0
def test_not_required_field_types():
    fields.Nullable(fields.String())._validate_model_value(None, 'test-value')
    fields.Nullable(fields.String())._validate_model_value(None, 'test-value')
    fields.Nullable(fields.String())._validate_builtin_value(
        None, 'test-value')
    fields.Nullable(fields.String())._validate_builtin_value(
        None, 'test-value')
Пример #9
0
class CheckOutput(Model):
    topic = CheckOutputTopic
    check_actor = fields.String(required=True)
    check_action = fields.String()
    status = fields.String(required=True)
    summary = fields.String(required=True)
    params = fields.List(fields.String(), required=True)
Пример #10
0
class MountEntry(Model):
    topic = SystemInfoTopic

    name = fields.String()
    mount = fields.String()
    tp = fields.String()
    options = fields.String()
Пример #11
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. """
Пример #12
0
class DialogModel(Model):
    topic = DialogTopic

    answerfile_sections = fields.JSON()
    actor = fields.String()
    details = fields.Nullable(fields.String())
    key = fields.Nullable(fields.String())
class TargetUserSpaceInfo(Model):
    """
    Information about the target userspace container to be able to use it

    The target userspace container contains the most crucial part of the target
    system to be able to proceed the inplace upgrade process (let's simplify
    it, and call it bootstrap of the target system). It contains (e.g.) the
    package manager of the target system, so we can calculate and process
    the RPM transaction. Additionally, it is used to create the upgrade
    initramfs (see the UpgradeInitramfsTasks model for more information).

    See the TargetUserSpaceTasks model for possibilities to influence content
    of the container automatically.
    """
    topic = TransactionTopic

    path = fields.String()
    """
    Path to the created target userspace directory

    It could be used as a container. It contains top level rootfs
    directories (bin, usr, var, ...).
    """

    scratch = fields.String()
    """
    Path to the directory with stored xfs-ftype workaround files

    It's not possible to create overlayfs over XFS without the ftype attribute.
    To workaround this problem, we are creating these files with EXT4 FS
    inside.
    """

    mounts = fields.String()
    """
Пример #14
0
class User(Model):
    topic = SystemFactsTopic

    name = fields.String()
    uid = fields.Integer()
    gid = fields.Integer()
    home = fields.String()
Пример #15
0
def test_list_field():
    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.String(), required=True,
                    allow_null=False)._validate_builtin_value(
                        'something', 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.String(), required=True,
                    allow_null=False)._convert_to_model(None, 'test-value')

    fields.List(fields.String(), required=True,
                allow_null=True)._convert_to_model(None, 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.String(), required=True,
                    allow_null=False)._convert_from_model(None, 'test-value')

    fields.List(fields.String(), required=True,
                allow_null=True)._convert_from_model(None, 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.Integer(),
                    minimum=1)._validate_builtin_value([], 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.Integer(),
                    minimum=1)._validate_model_value([], 'test-value')

    fields.List(fields.Integer(),
                minimum=1)._validate_builtin_value([1], 'test-value')
    fields.List(fields.Integer(),
                minimum=1)._validate_builtin_value([1, 2], 'test-value')
    fields.List(fields.Integer(),
                minimum=1)._validate_model_value([1], 'test-value')
    fields.List(fields.Integer(),
                minimum=1)._validate_model_value([1, 2], 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.Integer(), minimum=1,
                    maximum=1)._validate_builtin_value([1, 2], 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.Integer(), minimum=1,
                    maximum=1)._validate_model_value([1, 2], 'test-value')

    fields.List(fields.Integer(),
                maximum=2)._validate_builtin_value([1], 'test-value')
    fields.List(fields.Integer(),
                maximum=2)._validate_builtin_value([1, 2], 'test-value')

    fields.List(fields.Integer(),
                maximum=2)._validate_model_value([1], 'test-value')
    fields.List(fields.Integer(),
                maximum=2)._validate_model_value([1, 2], 'test-value')

    with pytest.raises(fields.ModelViolationError):
        fields.List(fields.Integer(),
                    maximum=3)._validate_builtin_value([1, 2, 3, 4],
                                                       'test-value')
Пример #16
0
class RepoMapEntry(Model):
    topic = TransactionTopic

    source = fields.String()
    """The source PES id."""

    target = fields.List(fields.String())
    """List of target PES ids"""
Пример #17
0
class KernelCmdlineArg(Model):
    """
    Single kernel command line argument to include to RHEL-8 kernel cmdline
    """
    topic = SystemInfoTopic

    key = fields.String()
    value = fields.String()
Пример #18
0
class RenamedInterface(Model):
    """
    Provide original and new name of the network interface when renamed
    """
    topic = SystemInfoTopic

    rhel7_name = fields.String()
    rhel8_name = fields.String()
Пример #19
0
class EnvVar(Model):
    topic = SystemInfoTopic

    name = fields.String()
    """Name of the environment variable."""

    value = fields.String()
    """Value of the environment variable."""
Пример #20
0
class Version(Model):
    topic = SystemInfoTopic

    source = fields.String()
    """Version of the source (current) system. E.g.: '7.8'."""

    target = fields.String()
    """Version of the target system. E.g. '8.2.'."""
Пример #21
0
class SELinuxModule(Model):
    """SELinux module in cil including priority"""
    topic = SystemInfoTopic
    name = fields.String()
    priority = fields.Integer()
    content = fields.String()
    # lines removed due to content invalid on RHEL 8
    removed = fields.List(fields.String())
Пример #22
0
class ErrorModel(Model):
    topic = ErrorTopic

    message = fields.String()
    severity = fields.StringEnum(choices=ErrorSeverity.ALLOWED_VALUES, default=ErrorSeverity.ERROR)
    details = fields.Nullable(fields.String())
    actor = fields.String()
    time = fields.DateTime()
Пример #23
0
class UsedRepository(Model):
    """
    Describe list of current packages installed from a specific repository
    """

    topic = SystemInfoTopic

    repository = fields.String()
    packages = fields.List(fields.String(), default=[])
Пример #24
0
class RepositoryData(Model):
    topic = SystemInfoTopic

    name = fields.String()
    baseurl = fields.Nullable(fields.String())
    metalink = fields.Nullable(fields.String())
    mirrorlist = fields.Nullable(fields.String())
    enabled = fields.Boolean(default=True)
    additional_fields = fields.Nullable(fields.String())
Пример #25
0
class ErrorModel(Model):
    topic = ErrorTopic

    message = fields.String(required=True)
    severity = fields.StringEnum(required=True,
                                 choices=ErrorSeverity.ALLOWED_VALUES,
                                 default=ErrorSeverity.ERROR)
    details = fields.String(required=True, allow_null=True, default=None)
    actor = fields.String(required=True)
    time = fields.DateTime(required=True)
Пример #26
0
class KernelCmdlineArg(Model):
    """
    Single kernel command line parameter with/without a value

    When produced alone, represents a parameter to include in RHEL-8 kernel cmdline.
    """
    topic = SystemInfoTopic

    key = fields.String()
    value = fields.Nullable(fields.String())
Пример #27
0
class PCIAddress(Model):
    """
    TODO: tbd
    """
    topic = SystemInfoTopic

    domain = fields.String()
    bus = fields.String()
    function = fields.String()
    device = fields.String()
Пример #28
0
class SkippedRepositories(Model):
    """
    Message that contains all skipped repositories and the packages that will not be upgraded as a result of those
    repositories being skipped.
    """
    topic = TransactionTopic
    repos = fields.List(fields.String(), default=[])
    """ List of repositories ids that are going to be skipped for the upgrade """
    packages = fields.List(fields.String(), default=[])
    """ List of packages that are not going to be upgraded because of skipped repositories """
Пример #29
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=[])
Пример #30
0
class AllFieldTypesModel(Model):
    topic = ModelTestTopic
    float_field = fields.Float(default=3.14, required=True)
    number_int_field = fields.Number(default=1.2, required=True)
    number_float_field = fields.Number(default=2, required=True)
    integer_field = fields.Integer(default=1, required=True)
    str_field = fields.String(default='string', required=True)
    unicode_field = fields.String(default=u'Unicode string', required=True)
    date_field = fields.DateTime(default=datetime.utcnow(), required=True)
    bool_field = fields.Boolean(default=True, required=True)