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
27f779a7
Commit
27f779a7
authored
Sep 18, 2015
by
Petr Mifek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small clean up and refactor of the rsync target ipv6 observing formatter for synchronize action.
parent
6f3f4dff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
lib/ansible/plugins/action/synchronize.py
+17
-14
No files found.
lib/ansible/plugins/action/synchronize.py
View file @
27f779a7
...
...
@@ -44,16 +44,25 @@ class ActionModule(ActionBase):
return
path
def
_format_rsync_rsh_target
(
self
,
host
,
path
,
user
):
''' formats rsync rsh target, escaping ipv6 addresses if needed '''
def
_needs_ipv6_brackets
(
host
):
return
':'
in
host
user_prefix
=
''
if
user
:
user_prefix
=
'
%
s@'
%
(
user
,
)
if
_needs_ipv6_brackets
(
host
):
return
'[
%
s
%
s]:
%
s'
%
(
user_prefix
,
host
,
path
)
else
:
return
'
%
s
%
s:
%
s'
%
(
user_prefix
,
host
,
path
)
def
_process_origin
(
self
,
host
,
path
,
user
):
if
host
not
in
C
.
LOCALHOST
:
userPart
=
''
if
user
:
userPart
=
'
%
s@'
%
(
user
,
)
if
":"
in
host
:
return
'[
%
s
%
s]:
%
s'
%
(
userPart
,
host
,
path
)
else
:
return
'
%
s
%
s:
%
s'
%
(
userPart
,
host
,
path
)
return
self
.
_format_rsync_rsh_target
(
host
,
path
,
user
)
if
':'
not
in
path
and
not
path
.
startswith
(
'/'
):
path
=
self
.
_get_absolute_path
(
path
=
path
)
...
...
@@ -62,13 +71,7 @@ class ActionModule(ActionBase):
def
_process_remote
(
self
,
host
,
path
,
user
):
transport
=
self
.
_play_context
.
connection
if
host
not
in
C
.
LOCALHOST
or
transport
!=
"local"
:
userPart
=
''
if
user
:
userPart
=
'
%
s@'
%
(
user
,
)
if
":"
in
host
:
return
'[
%
s
%
s]:
%
s'
%
(
userPart
,
host
,
path
)
else
:
return
'
%
s
%
s:
%
s'
%
(
userPart
,
host
,
path
)
return
self
.
_format_rsync_rsh_target
(
host
,
path
,
user
)
if
':'
not
in
path
and
not
path
.
startswith
(
'/'
):
path
=
self
.
_get_absolute_path
(
path
=
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