コード例 #1
0
ファイル: resources.py プロジェクト: turtlebender/kokki
class ElasticIP(Resource):
    actions = ["associate", "disassociate"]

    aws_access_key = ResourceArgument()
    aws_secret_access_key = ResourceArgument()
    ip = ResourceArgument()
    timeout = ResourceArgument(default=3 * 60)  # None or 0 for no timeout
コード例 #2
0
class PipPackage(Resource):
    provider = "*pip.PipPackageProvider"

    action = ForcedListArgument(default="install")
    package_name = ResourceArgument(default=lambda obj:obj.name)
    location = ResourceArgument(default=lambda obj:obj.package_name)
    version = ResourceArgument(required = True)
    actions = ["install", "upgrade", "remove", "purge"]
コード例 #3
0
ファイル: resources.py プロジェクト: sivareddydev/kokki
class EBSVolume(Resource):
    provider = "*aws.EBSVolumeProvider"

    actions = ["create", "attach", "detach", "snapshot"]

    volume_id = ResourceArgument()
    aws_access_key = ResourceArgument()
    aws_secret_access_key = ResourceArgument()
    size = ResourceArgument()
    snapshot_id = ResourceArgument()
    snapshot_required = ResourceArgument(default=False)
    availability_zone = ResourceArgument()
    device = ResourceArgument()
    linux_device = ResourceArgument()
    timeout = ResourceArgument(default=3*60) # None or 0 for no timeout
コード例 #4
0
ファイル: resources.py プロジェクト: turtlebender/kokki
class Array(Resource):
    provider = "*mdadm.ArrayProvider"

    actions = Resource.actions + ["create", "stop", "assemble"]

    action = ForcedListArgument(default="create")
    chunksize = ResourceArgument()
    level = ResourceArgument()
    metadata = ResourceArgument()
    devices = ForcedListArgument()

    def __init__(self, *args, **kwargs):
        super(Array, self).__init__(*args, **kwargs)
        self.subscribe("run",
                       self.env.resources["Execute"]["mdadm-update-conf"],
                       False)
コード例 #5
0
class SSHAuthorizedKey(Resource):
    provider = "*ssh.SSHAuthorizedKeyProvider"

    action = ForcedListArgument(default="include")
    keytype = ResourceArgument()
    key = ResourceArgument()
    user = ResourceArgument()
    path = ResourceArgument()

    actions = Resource.actions + ["include", "exclude"]

    def validate(self):
        if not self.path:
            if not self.user:
                raise Fail("[%s] Either path or user is required" % self)
            self.path = os.path.join(
                self.env.cookbooks.ssh.ssh_path_for_user(self.user),
                "authorized_keys")
コード例 #6
0
class SSHKnownHost(Resource):
    provider = "*ssh.SSHKnownHostProvider"

    action = ForcedListArgument(default="include")
    host = ResourceArgument(default=lambda obj: obj.name)
    keytype = ResourceArgument()
    key = ResourceArgument()
    hashed = BooleanArgument(default=True)
    user = ResourceArgument()
    path = ResourceArgument()

    actions = Resource.actions + ["include", "exclude"]

    def validate(self):
        if not self.path:
            if not self.user:
                raise Fail("[%s] Either path or user is required" % self)
            self.path = os.path.join(
                self.env.cookbooks.ssh.ssh_path_for_user(self.user),
                "known_hosts")