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
faf4c3bb
Commit
faf4c3bb
authored
Aug 05, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11816 from amenonsen/ssh-ipv6
Fix ssh connections to IPv6 addresses
parents
dbd755e0
72715c6a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
lib/ansible/plugins/connections/ssh.py
+6
-8
No files found.
lib/ansible/plugins/connections/ssh.py
View file @
faf4c3bb
...
@@ -57,11 +57,7 @@ class Connection(ConnectionBase):
...
@@ -57,11 +57,7 @@ class Connection(ConnectionBase):
super
(
Connection
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
Connection
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
# FIXME: make this work, should be set from connection info
self
.
_ipv6
=
False
self
.
host
=
self
.
_play_context
.
remote_addr
self
.
host
=
self
.
_play_context
.
remote_addr
if
self
.
_ipv6
:
self
.
host
=
'[
%
s]'
%
self
.
host
@property
@property
def
transport
(
self
):
def
transport
(
self
):
...
@@ -342,8 +338,6 @@ class Connection(ConnectionBase):
...
@@ -342,8 +338,6 @@ class Connection(ConnectionBase):
ssh_cmd
.
append
(
"-q"
)
ssh_cmd
.
append
(
"-q"
)
ssh_cmd
+=
self
.
_common_args
ssh_cmd
+=
self
.
_common_args
if
self
.
_ipv6
:
ssh_cmd
+=
[
'-6'
]
ssh_cmd
.
append
(
self
.
host
)
ssh_cmd
.
append
(
self
.
host
)
ssh_cmd
.
append
(
cmd
)
ssh_cmd
.
append
(
cmd
)
...
@@ -437,15 +431,19 @@ class Connection(ConnectionBase):
...
@@ -437,15 +431,19 @@ class Connection(ConnectionBase):
raise
AnsibleFileNotFound
(
"file or module does not exist: {0}"
.
format
(
in_path
))
raise
AnsibleFileNotFound
(
"file or module does not exist: {0}"
.
format
(
in_path
))
cmd
=
self
.
_password_cmd
()
cmd
=
self
.
_password_cmd
()
# scp and sftp require square brackets for IPv6 addresses, but
# accept them for hostnames and IPv4 addresses too.
host
=
'[
%
s]'
%
self
.
host
if
C
.
DEFAULT_SCP_IF_SSH
:
if
C
.
DEFAULT_SCP_IF_SSH
:
cmd
.
append
(
'scp'
)
cmd
.
append
(
'scp'
)
cmd
.
extend
(
self
.
_common_args
)
cmd
.
extend
(
self
.
_common_args
)
cmd
.
extend
([
in_path
,
'{0}:{1}'
.
format
(
self
.
host
,
pipes
.
quote
(
out_path
))])
cmd
.
extend
([
in_path
,
'{0}:{1}'
.
format
(
host
,
pipes
.
quote
(
out_path
))])
indata
=
None
indata
=
None
else
:
else
:
cmd
.
append
(
'sftp'
)
cmd
.
append
(
'sftp'
)
cmd
.
extend
(
self
.
_common_args
)
cmd
.
extend
(
self
.
_common_args
)
cmd
.
append
(
self
.
host
)
cmd
.
append
(
host
)
indata
=
"put {0} {1}
\n
"
.
format
(
pipes
.
quote
(
in_path
),
pipes
.
quote
(
out_path
))
indata
=
"put {0} {1}
\n
"
.
format
(
pipes
.
quote
(
in_path
),
pipes
.
quote
(
out_path
))
(
p
,
stdin
)
=
self
.
_run
(
cmd
,
indata
)
(
p
,
stdin
)
=
self
.
_run
(
cmd
,
indata
)
...
...
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