PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/schemas/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/schemas/common.py

"""
    :codeauthor: Pedro Algarvio (pedro@algarvio.me)


    salt.config.schemas.common
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Common salt configuration schemas
"""

from salt.utils.schema import ArrayItem, OneOfItem, Schema, StringItem


class DefaultIncludeConfig(StringItem):
    """
    Per default, the {0}, will automatically include all config files
    from '{1}/*.conf' ('{1}' is a sub-directory in the same directory
    as the main {0} config file).
    """

    __target__ = None
    __confd_directory__ = None

    title = "Include Config"
    description = __doc__

    def __init__(self, default=None, pattern=None, **kwargs):
        default = f"{self.__confd_directory__}/*.conf"
        pattern = r"(?:.*)/\*\.conf"
        super().__init__(default=default, pattern=pattern, **kwargs)

    def __validate_attributes__(self):
        self.__doc__ = DefaultIncludeConfig.__doc__.format(
            self.__target__, self.__confd_directory__
        )
        super().__validate_attributes__()

    def __get_description__(self):
        return self.__doc__.format(self.__target__, self.__confd_directory__)


class MinionDefaultInclude(DefaultIncludeConfig):
    __target__ = "minion"
    __confd_directory__ = "minion.d"


class MasterDefaultInclude(DefaultIncludeConfig):
    __target__ = "master"
    __confd_directory = "master.d"  # pylint: disable=unused-private-member


class IncludeConfig(Schema):
    title = "Include Configuration File(s)"
    description = "Include one or more specific configuration files"

    string_or_array = OneOfItem(items=(StringItem(), ArrayItem(items=StringItem())))(
        flatten=True
    )