Skip to content

Commit 89027a8

Browse files
committed
fix(registry): fix create_bucket s3 compatability
The create_bucket script in the registry has some incompatibilities with s3. In 1.12 deis is using the boto `lookup` function to determine whether a bucket exists or not. The boto s3 connection is created using an OrdinaryCallingFormat, for ceph compatibility. Unfortunately, S3 returns a 301 when lookup is called with OrdinaryCallingFormat, which causes the lookup function to return None. Prior to 1.12 the boto `get_all_buckets` function was used to determine whether a bucket existed or not, which does not seem to have this problem. I've fixed it by updating the create_bucket script to not pass an OrdinaryCallingFormat if the `/deis/registry/s3bucket` setting is present, which fixes this issue. I've also omitted the `is_secure=False` setting, which would cause boto to use s3 over http. Additionally, if `/deis/store/gateway/accessKey` is not present (which should be the case in a stateless setup) I'm using the s3 access keys configured for the registry. This fixes #4713 (and maybe #4710 and #4688). #4710 was labelled as a documentation bug, but I'm not sure it is - seems like the stateless registry should just read the s3 configuration from a single place rather than relying on the `/deis/store/gateway/accessKey` config that is usually set by the store-gateway.
1 parent 0bb7b6e commit 89027a8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

registry/templates/create_bucket

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ conn = boto.connect_s3(
88
{{ if exists "/deis/store/gateway/accessKey" }}
99
aws_access_key_id='{{ getv "/deis/store/gateway/accessKey" }}',
1010
aws_secret_access_key='{{ getv "/deis/store/gateway/secretKey" }}',
11-
{{end}}
11+
{{ else }}
12+
{{ if exists "/deis/registry/s3accessKey" }}
13+
aws_access_key_id='{{ getv "/deis/registry/s3accessKey" }}',
14+
aws_secret_access_key='{{ getv "/deis/registry/s3secretKey" }}',
15+
{{ end }}
16+
{{ end }}
1217
{{ if exists "/deis/store/gateway/host" }}
1318
host='{{ getv "/deis/store/gateway/host" }}',
1419
port={{ getv "/deis/store/gateway/port" }},
1520
{{ end }}
21+
{{ if exists "/deis/registry/s3bucket" }}
22+
is_secure=True)
23+
{{ else }}
1624
is_secure=False,
1725
calling_format=OrdinaryCallingFormat())
26+
{{ end }}
1827

1928
{{ if exists "/deis/registry/s3bucket" }}
2029
name = '{{ getv "/deis/registry/s3bucket" }}'

0 commit comments

Comments
 (0)