-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcreate_bucket
More file actions
26 lines (22 loc) · 807 Bytes
/
create_bucket
File metadata and controls
26 lines (22 loc) · 807 Bytes
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
#!/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" }}',
{{end}}
{{ if exists "/deis/store/gateway/host" }}
host='{{ getv "/deis/store/gateway/host" }}',
port={{ getv "/deis/store/gateway/port" }},
{{ end }}
is_secure=False,
calling_format=OrdinaryCallingFormat())
{{ if exists "/deis/registry/s3bucket" }}
name = '{{ getv "/deis/registry/s3bucket" }}'
{{ else }}
name = '{{ getv "/deis/registry/bucketName" }}'
{{ end }}
if name not in (bucket.name for bucket in conn.get_all_buckets()):
conn.create_bucket(name)