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
45cebd28
Commit
45cebd28
authored
Aug 16, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added remote_src to copy, now allows copying to be done on the target server
parent
1b7369cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
lib/ansible/plugins/action/copy.py
+9
-3
No files found.
lib/ansible/plugins/action/copy.py
View file @
45cebd28
...
...
@@ -42,6 +42,7 @@ class ActionModule(ActionBase):
raw
=
boolean
(
self
.
_task
.
args
.
get
(
'raw'
,
'no'
))
force
=
boolean
(
self
.
_task
.
args
.
get
(
'force'
,
'yes'
))
faf
=
self
.
_task
.
first_available_file
remote_src
=
boolean
(
self
.
_task
.
args
.
get
(
'remote_src'
,
False
))
if
(
source
is
None
and
content
is
None
and
faf
is
None
)
or
dest
is
None
:
return
dict
(
failed
=
True
,
msg
=
"src (or content) and dest are required"
)
...
...
@@ -77,6 +78,12 @@ class ActionModule(ActionBase):
source
=
self
.
_get_first_available_file
(
faf
,
task_vars
.
get
(
'_original_file'
,
None
))
if
source
is
None
:
return
dict
(
failed
=
True
,
msg
=
"could not find src in first_available_file list"
)
elif
remote_src
:
new_module_args
=
self
.
_task
.
args
.
copy
()
del
new_module_args
[
'remote_src'
]
return
self
.
_execute_module
(
module_name
=
'copy'
,
module_args
=
new_module_args
,
task_vars
=
task_vars
,
delete_remote_tmp
=
False
)
else
:
if
self
.
_task
.
_role
is
not
None
:
source
=
self
.
_loader
.
path_dwim_relative
(
self
.
_task
.
_role
.
_role_path
,
'files'
,
source
)
...
...
@@ -109,7 +116,6 @@ class ActionModule(ActionBase):
source_files
.
append
((
source
,
os
.
path
.
basename
(
source
)))
changed
=
False
diffs
=
[]
module_result
=
{
"changed"
:
False
}
# A register for if we executed a module.
...
...
@@ -127,6 +133,7 @@ class ActionModule(ActionBase):
# expand any user home dir specifier
dest
=
self
.
_remote_expand_user
(
dest
,
tmp
)
diffs
=
[]
for
source_full
,
source_rel
in
source_files
:
# Generate a hash of the local file.
...
...
@@ -256,14 +263,13 @@ class ActionModule(ActionBase):
if
(
not
C
.
DEFAULT_KEEP_REMOTE_FILES
and
not
delete_remote_tmp
)
or
(
not
C
.
DEFAULT_KEEP_REMOTE_FILES
and
delete_remote_tmp
and
not
module_executed
):
self
.
_remove_tmp_path
(
tmp
)
# TODO: Support detailed status/diff for multiple files
if
module_executed
and
len
(
source_files
)
==
1
:
result
=
module_return
else
:
result
=
dict
(
dest
=
dest
,
src
=
source
,
changed
=
changed
)
if
len
(
diffs
)
==
1
:
result
[
'diff'
]
=
diffs
[
0
]
result
[
'diff'
]
=
diffs
[
0
]
return
result
...
...
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