Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
1317ece6
Commit
1317ece6
authored
Oct 16, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4543 from lorin/s3-walrus
s3: better check for walrus
parents
807e6022
1c5bdba9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
library/cloud/s3
+11
-1
No files found.
library/cloud/s3
View file @
1317ece6
...
...
@@ -238,6 +238,16 @@ def get_download_url(module, s3, bucket, obj, expiry, changed=True):
except
s3
.
provider
.
storage_response_error
,
e
:
module
.
fail_json
(
msg
=
str
(
e
))
def
is_walrus
(
s3_url
):
""" Return True if it's Walrus endpoint, not S3
We assume anything other than *.amazonaws.com is Walrus"""
if
s3_url
is
not
None
:
o
=
urlparse
.
urlparse
(
s3_url
)
return
not
o
.
hostname
.
endswith
(
'amazonaws.com'
)
else
:
return
False
def
main
():
module
=
AnsibleModule
(
argument_spec
=
dict
(
...
...
@@ -286,7 +296,7 @@ def main():
aws_access_key
=
os
.
environ
[
'EC2_ACCESS_KEY'
]
# If we have an S3_URL env var set, this is likely to be Walrus, so change connection method
if
'S3_URL'
in
os
.
environ
:
if
is_walrus
(
s3_url
)
:
try
:
walrus
=
urlparse
.
urlparse
(
s3_url
)
.
hostname
s3
=
boto
.
connect_walrus
(
walrus
,
aws_access_key
,
aws_secret_key
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment