-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcreate_bucket
More file actions
35 lines (31 loc) · 1.05 KB
/
create_bucket
File metadata and controls
35 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import boto
import sys
from boto.s3.connection import OrdinaryCallingFormat
conn = boto.connect_s3(
{{ if exists "/deis/store/gateway/accessKey" }}
aws_access_key_id='{{ getv "/deis/store/gateway/accessKey" }}',
aws_secret_access_key='{{ getv "/deis/store/gateway/secretKey" }}',
{{ else }}
{{ if exists "/deis/registry/s3accessKey" }}
aws_access_key_id='{{ getv "/deis/registry/s3accessKey" }}',
aws_secret_access_key='{{ getv "/deis/registry/s3secretKey" }}',
{{ end }}
{{ end }}
{{ if exists "/deis/store/gateway/host" }}
host='{{ getv "/deis/store/gateway/host" }}',
port={{ getv "/deis/store/gateway/port" }},
{{ end }}
{{ if exists "/deis/registry/s3bucket" }}
is_secure=True)
{{ else }}
is_secure=False,
calling_format=OrdinaryCallingFormat())
{{ end }}
{{ if exists "/deis/registry/s3bucket" }}
name = '{{ getv "/deis/registry/s3bucket" }}'
{{ else }}
name = '{{ getv "/deis/registry/bucketName" }}'
{{ end }}
if conn.lookup(name) is None:
conn.create_bucket(name)