Beispiel #1
0
class AhvVmSmallProfile(VmProfile):
    """Small Ahv Vm Profile"""

    # Profile variables
    nameserver = Var(DNS_SERVER, label="Local DNS resolver")

    # VM Spec for Substrate
    provider_spec = ahv_vm(resources=SmallAhvVmResources, name="SmallAhvVm")

    # Readiness probe for substrate (disabled is set to false, for enabling check login)
    readiness_probe = readiness_probe(credential=ref(Centos), disabled=False)

    environments = [Ref.Environment(name=ENV_NAME)]

    # Only actions under Packages, Substrates and Profiles are allowed
    @action
    def __install__():
        Task.Exec.ssh(name="Task1",
                      filename=os.path.join("scripts",
                                            "mysql_install_script.sh"))

    @action
    def __pre_create__():
        Task.Exec.escript(name="Pre Create Task", script="print 'Hello!'")

    @action
    def test_profile_action():
        Task.Exec.ssh(name="Task9", script='echo "Hello"')
class HelloProfile(Profile):

    # Deployments under this profile
    deployments = [HelloDeployment]

    restore_configs = [AppProtection.RestoreConfig("r1")]
    snapshot_configs = [AppProtection.SnapshotConfig("s1")]
    environments = [Ref.Environment(name="env1")]
Beispiel #3
0
class AhvVmProfile2(Profile):
    """Sample application profile with variables"""

    nameserver = CalmVariable.Simple("10.40.64.15", label="Local DNS resolver")
    foo1 = CalmVariable.Simple("bar1", runtime=True)
    foo2 = CalmVariable.Simple("bar2", runtime=True)

    deployments = [AhvVmDeployment2]
    environments = [Ref.Environment(name=ENV_NAME)]

    @action
    def test_profile_action():
        """Sample description for a profile action"""
        CalmTask.Exec.ssh(name="Task5",
                          script='echo "Hello"',
                          target=ref(AhvVmService))
Beispiel #4
0
class DefaultProfile(Profile):
    """Sample application profile with variables"""

    nameserver = CalmVariable.Simple(DNS_SERVER, label="Local DNS resolver")
    foo1 = CalmVariable.Simple("bar1", runtime=True)
    foo2 = CalmVariable.Simple("bar2", runtime=True)

    deployments = [MySQLDeployment, PHPDeployment]

    environments = [
        Ref.Environment(name=ENV_NAME),
    ]

    @action
    def test_profile_action():
        """Sample description for a profile action"""
        CalmTask.Exec.ssh(name="Task5", script='echo "Hello"', target=ref(MySQLService))
        PHPService.test_action(name="Task6")
Beispiel #5
0
class HelloProfile(Profile):

    # Deployments under this profile
    deployments = [HelloDeployment]

    restore_configs = [
        AppProtection.RestoreConfig("r1", target=ref(HelloDeployment))
    ]
    snapshot_configs = [
        AppProtection.SnapshotConfig(
            "s1",
            policy=AppProtection.ProtectionPolicy(
                "p221", rule_name="rule_0bb6745f8a104e5e3791bbfd7413f5d5"))
    ]
    environments = [Ref.Environment(name="env1")]

    @action
    def custom_action():
        Task.ConfigExec(config=ref(HelloProfile.restore_configs[0]),
                        name="Execute restore config task")
Beispiel #6
0
class SingleVmBlueprint(SimpleBlueprint):
    """Single VM blueprint"""

    credentials = [Centos]
    deployments = [VmDeployment]
    environments = [Ref.Environment(name=ENV_NAME, )]