コード例 #1
0
#!/usr/bin/env python
"""Print the names of the OpsWorks stacks defined"""
import os,sys
from myboto3 import stackNames

if len(sys.argv) != 1:
    print("""usage: %s

Print the names of the OpsWorks stacks defined.
""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

print(', '.join(stackNames()))
コード例 #2
0
import os, sys
from myboto3 import ops_client, stackNames, stackId_from_name, layerId_from_stackId_and_name

if not (1 <= len(sys.argv) <= 2):
    print("""usage:
%s [*StackName*]

Delete all OpsWorks layers in stack *StackName*. If no
*StackName* is given we use BotoTest
""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

stackName = 'BotoTest'
if len(sys.argv) == 2: stackName = sys.argv[1]

if stackName not in stackNames():
    print("Stack %s doesn't exists, nothing done" % stackName)
    sys.exit(2)

stackId = stackId_from_name(stackName)
if stackId is None:
    print("Can't find stack with name %s" % stackName)
    sys.exit(3)

resp = ops_client.describe_layers(StackId=stackId)
count = 0
for layer in resp['Layers']:
    count += 1
    result = ops_client.delete_layer(LayerId=layer['LayerId'])
    print("Layer %s of %s deleted" % (layer['Name'], stackName))
    print(result)
コード例 #3
0
#!/usr/bin/env python
import os, sys
from myboto3 import ops_client, stackNames

stackName = 'BotoTest'
if not(1 <= len(sys.argv) <= 2):
    print("""usage: %s [*StackName*]

Create Opworks stack for php cachet test application.
The default stack is %s.""" % (os.path.basename(sys.argv[0]), stackName))
    sys.exit(1)

if len(sys.argv) == 2: stackName = sys.argv[1]

if stackName in stackNames():
    print("Stack %s already exists, nothing done" % stackName)
    sys.exit(2)

try:
    sshKey = open("/home/rocky/.ssh/bitbucket4behance", 'r').read()
except:
    print("Warning: couldn't read ssh key, using a bogus one")
    sshKey = 'You need to fix this up'


result = ops_client.create_stack(
    # Required parameters
    Name=stackName,
    ServiceRoleArn='arn:aws:iam::587255138864:role/aws-opsworks-service-role',
    DefaultInstanceProfileArn='arn:aws:iam::587255138864:instance-profile/aws-opsworks-ec2-role',  # NOQA
コード例 #4
0
#!/usr/bin/env python
import os, sys
from myboto3 import ops_client, stackNames

stackName = 'BotoTest'
if not (1 <= len(sys.argv) <= 2):
    print("""usage: %s [*StackName*]

Create Opworks stack for php cachet test application.
The default stack is %s.""" % (os.path.basename(sys.argv[0]), stackName))
    sys.exit(1)

if len(sys.argv) == 2: stackName = sys.argv[1]

if stackName in stackNames():
    print("Stack %s already exists, nothing done" % stackName)
    sys.exit(2)

try:
    sshKey = open("/home/rocky/.ssh/bitbucket4behance", 'r').read()
except:
    print("Warning: couldn't read ssh key, using a bogus one")
    sshKey = 'You need to fix this up'

result = ops_client.create_stack(
    # Required parameters
    Name=stackName,
    ServiceRoleArn='arn:aws:iam::587255138864:role/aws-opsworks-service-role',
    DefaultInstanceProfileArn=
    'arn:aws:iam::587255138864:instance-profile/aws-opsworks-ec2-role',  # NOQA
コード例 #5
0
#!/usr/bin/env python
"""Print the names of the OpsWorks stacks defined"""
import os, sys
from myboto3 import stackNames

if len(sys.argv) != 1:
    print("""usage: %s

Print the names of the OpsWorks stacks defined.
""" % os.path.basename(sys.argv[0]))
    sys.exit(1)

print(', '.join(stackNames()))