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
21ba529f
Commit
21ba529f
authored
Jun 18, 2014
by
Chris Church
Committed by
Matt Martz
Jun 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes/notes related to slashes in remote paths.
parent
4991c774
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
9 deletions
+16
-9
lib/ansible/runner/action_plugins/copy.py
+6
-6
lib/ansible/runner/action_plugins/fetch.py
+1
-1
lib/ansible/runner/action_plugins/template.py
+1
-1
lib/ansible/runner/action_plugins/unarchive.py
+1
-1
lib/ansible/runner/shell_plugins/powershell.py
+4
-0
lib/ansible/runner/shell_plugins/sh.py
+3
-0
No files found.
lib/ansible/runner/action_plugins/copy.py
View file @
21ba529f
...
...
@@ -136,8 +136,8 @@ class ActionModule(object):
# If it's recursive copy, destination is always a dir,
# explicitly mark it so (note - copy module relies on this).
if
not
dest
.
endswith
(
"/"
):
dest
+=
"/"
if
not
conn
.
shell
.
path_has_trailing_slash
(
dest
):
dest
=
conn
.
shell
.
join_path
(
dest
,
''
)
else
:
source_files
.
append
((
source
,
os
.
path
.
basename
(
source
)))
...
...
@@ -169,10 +169,10 @@ class ActionModule(object):
# This is kind of optimization - if user told us destination is
# dir, do path manipulation right away, otherwise we still check
# for dest being a dir via remote call below.
if
dest
.
endswith
(
"/"
):
# CCTODO: Fixme for powershell
dest_file
=
os
.
path
.
join
(
dest
,
source_rel
)
if
conn
.
shell
.
path_has_trailing_slash
(
dest
):
dest_file
=
conn
.
shell
.
join_path
(
dest
,
source_rel
)
else
:
dest_file
=
dest
dest_file
=
conn
.
shell
.
join_path
(
dest
)
# Attempt to get the remote MD5 Hash.
remote_md5
=
self
.
runner
.
_remote_md5
(
conn
,
tmp_path
,
dest_file
)
...
...
@@ -186,7 +186,7 @@ class ActionModule(object):
return
ReturnData
(
conn
=
conn
,
result
=
result
)
else
:
# Append the relative source location to the destination and retry remote_md5.
dest_file
=
os
.
path
.
join
(
dest
,
source_rel
)
# CCTODO
dest_file
=
conn
.
shell
.
join_path
(
dest
,
source_rel
)
remote_md5
=
self
.
runner
.
_remote_md5
(
conn
,
tmp_path
,
dest_file
)
if
remote_md5
!=
'1'
and
not
force
:
...
...
lib/ansible/runner/action_plugins/fetch.py
View file @
21ba529f
...
...
@@ -59,7 +59,7 @@ class ActionModule(object):
source
=
os
.
path
.
expanduser
(
source
)
if
flat
:
if
dest
.
endswith
(
"/"
):
# CCTODO
if
dest
.
endswith
(
"/"
):
# CCTODO
: Fix path for Windows hosts.
# if the path ends with "/", we'll use the source filename as the
# destination filename
base
=
os
.
path
.
basename
(
source
)
...
...
lib/ansible/runner/action_plugins/template.py
View file @
21ba529f
...
...
@@ -79,7 +79,7 @@ class ActionModule(object):
source
=
utils
.
path_dwim
(
self
.
runner
.
basedir
,
source
)
if
dest
.
endswith
(
"/"
):
# CCTODO
if
dest
.
endswith
(
"/"
):
# CCTODO
: Fix path for Windows hosts.
base
=
os
.
path
.
basename
(
source
)
dest
=
os
.
path
.
join
(
dest
,
base
)
...
...
lib/ansible/runner/action_plugins/unarchive.py
View file @
21ba529f
...
...
@@ -54,7 +54,7 @@ class ActionModule(object):
result
=
dict
(
failed
=
True
,
msg
=
"src (or content) and dest are required"
)
return
ReturnData
(
conn
=
conn
,
result
=
result
)
dest
=
os
.
path
.
expanduser
(
dest
)
dest
=
os
.
path
.
expanduser
(
dest
)
# CCTODO: Fix path for Windows hosts.
source
=
template
.
template
(
self
.
runner
.
basedir
,
os
.
path
.
expanduser
(
source
),
inject
)
if
copy
:
if
'_original_file'
in
inject
:
...
...
lib/ansible/runner/shell_plugins/powershell.py
View file @
21ba529f
...
...
@@ -58,6 +58,10 @@ class ShellModule(object):
def
join_path
(
self
,
*
args
):
return
os
.
path
.
join
(
*
args
)
.
replace
(
'/'
,
'
\\
'
)
def
path_has_trailing_slash
(
self
,
path
):
# Allow Windows paths to be specified using either slash.
return
path
.
endswith
(
'/'
)
or
path
.
endswith
(
'
\\
'
)
def
chmod
(
self
,
mode
,
path
):
return
''
...
...
lib/ansible/runner/shell_plugins/sh.py
View file @
21ba529f
...
...
@@ -33,6 +33,9 @@ class ShellModule(object):
def
join_path
(
self
,
*
args
):
return
os
.
path
.
join
(
*
args
)
def
path_has_trailing_slash
(
self
,
path
):
return
path
.
endswith
(
'/'
)
def
chmod
(
self
,
mode
,
path
):
path
=
pipes
.
quote
(
path
)
return
'chmod
%
s
%
s'
%
(
mode
,
path
)
...
...
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