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
8849be66
Commit
8849be66
authored
May 05, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2830 from ralph-tice/devel
amended s3 plugin to support 'dest' parameter
parents
62453e1d
918de8d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
library/cloud/s3
+15
-4
No files found.
library/cloud/s3
View file @
8849be66
...
...
@@ -39,6 +39,12 @@ options:
required: false
default: null
aliases: []
dest:
description:
- the destination in s3, if different from path
required: false
default: null
aliases: []
expiry:
description:
- expiry period (in seconds) for returned download URL.
...
...
@@ -52,7 +58,7 @@ options:
default: false
version_added: "1.2"
requirements: [ "boto" ]
author: Lester Wade
author: Lester Wade
, Ralph Tice
'''
EXAMPLES
=
'''
...
...
@@ -95,6 +101,7 @@ def main():
argument_spec
=
dict
(
bucket
=
dict
(),
path
=
dict
(),
dest
=
dict
(),
state
=
dict
(
choices
=
[
'present'
,
'absent'
]),
expiry
=
dict
(
default
=
600
),
s3_url
=
dict
(
aliases
=
[
'S3_URL'
]),
...
...
@@ -107,6 +114,7 @@ def main():
bucket_name
=
module
.
params
.
get
(
'bucket'
)
path
=
os
.
path
.
expanduser
(
module
.
params
[
'path'
])
dest
=
module
.
params
.
get
(
'dest'
)
state
=
module
.
params
.
get
(
'state'
)
expiry
=
int
(
module
.
params
[
'expiry'
])
s3_url
=
module
.
params
.
get
(
's3_url'
)
...
...
@@ -159,9 +167,12 @@ def main():
module
.
fail_json
(
msg
=
"Source
%
s cannot be found"
%
(
path
),
failed
=
failed
)
sys
.
exit
(
0
)
# Default to setting the key to the same as the filename if not downloading. Adding custom key would be trivial.
key_name
=
os
.
path
.
basename
(
path
)
# Default to setting the key to the same as the filename if dest is not provided.
if
dest
is
None
:
key_name
=
os
.
path
.
basename
(
path
)
else
:
key_name
=
dest
# Check to see if the key already exists
if
bucket_exists
is
True
:
try
:
...
...
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