示例#1
0
文件: link.py 项目: marchon/yaybu
class LinkAppliedPolicy(Policy):
    resource = Link
    name = "apply"
    default = True
    signature = (
        Present("name"),
        Present("to"),
        )
示例#2
0
class ServiceStopPolicy(Policy):
    """ Stop a service if it is running """

    resource = Service
    name = "stop"
    signature = (
        Present("name"),
        NAND(Present("running"), Present("pidfile")),
    )
示例#3
0
class MountPolicy(Policy):
    resource = Mount
    name = "apply"
    default = True
    signature = (
        Present("name"),
        Present("fs_type"),
        Present("device"),
    )
示例#4
0
class ServiceStartPolicy(Policy):
    """ Start a service if it isn't running """

    resource = Service
    name = "start"
    default = True
    signature = (
        Present("name"),
        NAND(Present("running"), Present("pidfile")),
    )
示例#5
0
class CheckoutExportPolicy(Policy):
    """ Perform an export of the remote location, as for example "svn export".
    This means this is not a working copy of the remote location, it is
    instead a clean copy of the specified source material. """

    resource = Checkout
    name = "export"
    default = False
    signature = (
        Present("name"),
        Present("repository"),
    )
示例#6
0
class ExecutePolicy(Policy):

    """ Execute the the command or commands provided.

    If user or group attributes are provided the command will be run using sudo."""

    resource = Execute
    name = "execute"
    default = True
    signature = (Present("name"),
                 XOR(Present("command"), Present("commands")),
                 )
示例#7
0
class ServiceReloadPolicy(Policy):
    """ Get the service to reload its configuration

    If a service isn't running it will just be started instead.
    """

    resource = Service
    name = "reconfig"
    signature = (
        Present("name"),
        NAND(Present("running"), Present("pidfile")),
    )
示例#8
0
class ServiceRestartPolicy(Policy):
    """ Restart a service

    If a service isn't running it will just be started instead.
    """

    resource = Service
    name = "restart"
    signature = (
        Present("name"),
        NAND(Present("running"), Present("pidfile")),
    )
示例#9
0
class DirectoryAppliedPolicy(Policy):
    """ Ensure a directory exists and matches the specification provided
    by the resource. """

    resource = Directory
    name = "apply"
    default = True
    signature = (
        Present("name"),
        Present("owner"),
        Present("group"),
        Present("mode"),
    )
示例#10
0
class CheckoutSyncPolicy(Policy):
    """ Synchronise the working copy with the remote SCM location. This is
    done by performing appropriate "switch" and "update" operations such that
    the working copy ends up in the correct state. This will never commit
    changes from the working copy - it is intended to track a remote location
    only. """

    resource = Checkout
    name = "sync"
    default = True
    signature = (
        Present("name"),
        Present("repository"),
    )
示例#11
0
文件: prompt.py 项目: marchon/yaybu
class PromptPolicy(Policy):

    """ Prompt the operator.

    The value of the question attribute will be displayed to the operator and
    deployment will not continue until they acknowledge the prompt."""

    resource = Prompt
    name = "prompt"
    default = True
    signature = (
        Present("name"),
        Present("question"),
        )
示例#12
0
文件: user.py 项目: mitchellrj/yaybu
class UserApplyPolicy(Policy):
    """ Create or change the specified user.

    It might not be possible to apply some changes to existing users, for example
    the systeam attribute only makes sense at the point a user is created.
    """

    resource = User
    name = "apply"
    default = True

    signature = (
        Present("name"),
        NAND(Present("password"), Present("disabled_login")),
    )
示例#13
0
class FileApplyPolicy(Policy):
    """ Create a file and populate it's contents if required.

    You must provide a name.

    You may provide one of template, static, or encrypted to act as a file source.
    """

    resource = File
    name = "apply"
    default = True
    signature = (
        Present("name"),
        NAND(Present("template"), Present("static"), Present("encrypted")),
    )
示例#14
0
class GroupApplyPolicy(Policy):
    """ Create the group, or ensure it has the specified attributes. """

    resource = Group
    name = "apply"
    default = True
    signature = (Present("name"), )
示例#15
0
文件: link.py 项目: marchon/yaybu
class LinkRemovedPolicy(Policy):
    resource = Link
    name = "remove"
    default = False
    signature = (
        Present("name"),
        Absent("to"),
        )
示例#16
0
文件: patch.py 项目: mitchellrj/yaybu
class PatchApplyPolicy(Policy):
    """ Apply a patch.

    You must provide a target.
    """

    resource = Patch
    name = "apply"
    default = True
    signature = (Present("name"), )
示例#17
0
class PackageUninstallPolicy(Policy):
    """ Uninstall the specified package, if it is installed. """

    resource = Package
    name = "uninstall"
    default = False
    signature = (
        Present("name"),
        Absent("version"),
    )
示例#18
0
class PackageInstallPolicy(Policy):
    """ Install the specified package. If the package is already installed it
    will not be upgraded or changed. Your package upgrade and patching
    strategy should be independent of Yaybu in general.
    """

    resource = Package
    name = "install"
    default = True
    signature = (
        Present("name"),
        Absent("purge"),
    )
示例#19
0
class GroupRemovePolicy(Policy):
    """ Remove an existing group if it still exists.

    You should only specify the name of the group when using this policy."""

    resource = Group
    name = "remove"
    default = False
    signature = (
        Present("name"),
        Absent("gid"),
        Absent("system"),
        Absent("password"),
    )
示例#20
0
class SpecialAppliedPolicy(Policy):
    """ Ensure a block or character special file exists """

    name = "apply"
    default = True
    signature = (
        Present("name"),
        Present("owner"),
        Present("group"),
        Present("mode"),
        Present("type"),
        Present("major"),
        Present("minor"),
    )
示例#21
0
class DirectoryRemovedRecursivePolicy(Policy):
    """ If a directory described by this resource exists then remove it and
    its children.

    You should only provided the path to the directory when using this policy.
    """

    resource = Directory
    name = "remove-recursive"
    default = False
    signature = (
        Present("name"),
        Absent("owner"),
        Absent("group"),
        Absent("mode"),
    )
示例#22
0
文件: file.py 项目: mitchellrj/yaybu
class FileRemovePolicy(Policy):
    """ Delete a file if it exists. You should only provide the name in this
    case. """

    resource = File
    name = "remove"
    default = False
    signature = (
        Present("name"),
        Absent("owner"),
        Absent("group"),
        Absent("mode"),
        Absent("static"),
        Absent("template"),
        Absent("template_args"),
    )
示例#23
0
class SpecialRemovedPolicy(Policy):
    """ If the special file specified exists, remove it.

    You should only specify the special file to remove, the other fields are
    not needed """

    name = "remove"
    default = False
    signature = (
        Present("name"),
        Absent("owner"),
        Absent("group"),
        Absent("mode"),
        Absent("type"),
        Absent("major"),
        Absent("minor"),
    )
示例#24
0
class DirectoryRemovedPolicy(Policy):
    """ If a directory described by this resource exists then remove it.

    This isn't recursive, if you want to remove a directory and all its contents
    use `removed-recursive`.

    You should only provided the path to the directory when using this policy.
    """

    resource = Directory
    name = "remove"
    default = False
    signature = (
        Present("name"),
        Absent("owner"),
        Absent("group"),
        Absent("mode"),
    )