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
8574d40b
Commit
8574d40b
authored
Apr 24, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial work to make paramiko connections work under v2
parent
8c08f1b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
41 deletions
+29
-41
v2/ansible/executor/connection_info.py
+8
-9
v2/ansible/executor/process/worker.py
+13
-16
v2/ansible/executor/task_executor.py
+3
-2
v2/ansible/executor/task_queue_manager.py
+1
-12
v2/ansible/plugins/connections/__init__.py
+3
-1
v2/ansible/plugins/connections/paramiko_ssh.py
+0
-0
v2/ansible/plugins/connections/ssh.py
+1
-1
No files found.
v2/ansible/executor/connection_info.py
View file @
8574d40b
...
...
@@ -44,12 +44,13 @@ class ConnectionInformation:
passwords
=
{}
# connection
self
.
connection
=
None
self
.
remote_addr
=
None
self
.
remote_user
=
None
self
.
password
=
passwords
.
get
(
'conn_pass'
,
''
)
self
.
port
=
None
self
.
private_key_file
=
None
self
.
connection
=
None
self
.
remote_addr
=
None
self
.
remote_user
=
None
self
.
password
=
passwords
.
get
(
'conn_pass'
,
''
)
self
.
port
=
22
self
.
private_key_file
=
C
.
DEFAULT_PRIVATE_KEY_FILE
self
.
timeout
=
C
.
DEFAULT_TIMEOUT
# privilege escalation
self
.
become
=
None
...
...
@@ -119,9 +120,7 @@ class ConnectionInformation:
self
.
connection
=
options
.
connection
self
.
remote_user
=
options
.
remote_user
#if 'port' in options and options.port is not None:
# self.port = options.port
self
.
private_key_file
=
None
self
.
private_key_file
=
options
.
private_key_file
# privilege escalation
self
.
become
=
options
.
become
...
...
v2/ansible/executor/process/worker.py
View file @
8574d40b
...
...
@@ -51,7 +51,7 @@ class WorkerProcess(multiprocessing.Process):
for reading later.
'''
def
__init__
(
self
,
tqm
,
main_q
,
rslt_q
,
loader
,
new_stdin
):
def
__init__
(
self
,
tqm
,
main_q
,
rslt_q
,
loader
):
# takes a task queue manager as the sole param:
self
.
_main_q
=
main_q
...
...
@@ -59,23 +59,20 @@ class WorkerProcess(multiprocessing.Process):
self
.
_loader
=
loader
# dupe stdin, if we have one
self
.
_new_stdin
=
sys
.
stdin
try
:
fileno
=
sys
.
stdin
.
fileno
()
if
fileno
is
not
None
:
try
:
self
.
_new_stdin
=
os
.
fdopen
(
os
.
dup
(
fileno
))
except
OSError
,
e
:
# couldn't dupe stdin, most likely because it's
# not a valid file descriptor, so we just rely on
# using the one that was passed in
pass
except
ValueError
:
fileno
=
None
self
.
_new_stdin
=
new_stdin
if
not
new_stdin
and
fileno
is
not
None
:
try
:
self
.
_new_stdin
=
os
.
fdopen
(
os
.
dup
(
fileno
))
except
OSError
,
e
:
# couldn't dupe stdin, most likely because it's
# not a valid file descriptor, so we just rely on
# using the one that was passed in
pass
if
self
.
_new_stdin
:
sys
.
stdin
=
self
.
_new_stdin
# couldn't get stdin's fileno, so we just carry on
pass
super
(
WorkerProcess
,
self
)
.
__init__
()
...
...
@@ -118,7 +115,7 @@ class WorkerProcess(multiprocessing.Process):
# execute the task and build a TaskResult from the result
debug
(
"running TaskExecutor() for
%
s/
%
s"
%
(
host
,
task
))
executor_result
=
TaskExecutor
(
host
,
task
,
job_vars
,
new_connection_info
,
self
.
_loader
,
module_loader
)
.
run
()
executor_result
=
TaskExecutor
(
host
,
task
,
job_vars
,
new_connection_info
,
self
.
_
new_stdin
,
self
.
_
loader
,
module_loader
)
.
run
()
debug
(
"done running TaskExecutor() for
%
s/
%
s"
%
(
host
,
task
))
task_result
=
TaskResult
(
host
,
task
,
executor_result
)
...
...
v2/ansible/executor/task_executor.py
View file @
8574d40b
...
...
@@ -45,11 +45,12 @@ class TaskExecutor:
class.
'''
def
__init__
(
self
,
host
,
task
,
job_vars
,
connection_info
,
loader
,
module_loader
):
def
__init__
(
self
,
host
,
task
,
job_vars
,
connection_info
,
new_stdin
,
loader
,
module_loader
):
self
.
_host
=
host
self
.
_task
=
task
self
.
_job_vars
=
job_vars
self
.
_connection_info
=
connection_info
self
.
_new_stdin
=
new_stdin
self
.
_loader
=
loader
self
.
_module_loader
=
module_loader
...
...
@@ -370,7 +371,7 @@ class TaskExecutor:
if
conn_type
==
'smart'
:
conn_type
=
'ssh'
connection
=
connection_loader
.
get
(
conn_type
,
self
.
_connection_info
)
connection
=
connection_loader
.
get
(
conn_type
,
self
.
_connection_info
,
self
.
_new_stdin
)
if
not
connection
:
raise
AnsibleError
(
"the connection plugin '
%
s' was not found"
%
conn_type
)
...
...
v2/ansible/executor/task_queue_manager.py
View file @
8574d40b
...
...
@@ -87,21 +87,10 @@ class TaskQueueManager:
self
.
_workers
=
[]
for
i
in
range
(
self
.
_options
.
forks
):
# duplicate stdin, if possible
new_stdin
=
None
if
fileno
is
not
None
:
try
:
new_stdin
=
os
.
fdopen
(
os
.
dup
(
fileno
))
except
OSError
:
# couldn't dupe stdin, most likely because it's
# not a valid file descriptor, so we just rely on
# using the one that was passed in
pass
main_q
=
multiprocessing
.
Queue
()
rslt_q
=
multiprocessing
.
Queue
()
prc
=
WorkerProcess
(
self
,
main_q
,
rslt_q
,
loader
,
new_stdin
)
prc
=
WorkerProcess
(
self
,
main_q
,
rslt_q
,
loader
)
prc
.
start
()
self
.
_workers
.
append
((
prc
,
main_q
,
rslt_q
))
...
...
v2/ansible/plugins/connections/__init__.py
View file @
8574d40b
...
...
@@ -43,10 +43,12 @@ class ConnectionBase:
has_pipelining
=
False
become_methods
=
C
.
BECOME_METHODS
def
__init__
(
self
,
connection_info
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
connection_info
,
new_stdin
,
*
args
,
**
kwargs
):
# All these hasattrs allow subclasses to override these parameters
if
not
hasattr
(
self
,
'_connection_info'
):
self
.
_connection_info
=
connection_info
if
not
hasattr
(
self
,
'_new_stdin'
):
self
.
_new_stdin
=
new_stdin
if
not
hasattr
(
self
,
'_display'
):
self
.
_display
=
Display
(
verbosity
=
connection_info
.
verbosity
)
if
not
hasattr
(
self
,
'_connected'
):
...
...
v2/ansible/plugins/connections/paramiko_ssh.py
View file @
8574d40b
This diff is collapsed.
Click to expand it.
v2/ansible/plugins/connections/ssh.py
View file @
8574d40b
...
...
@@ -50,7 +50,7 @@ class Connection(ConnectionBase):
self
.
_cp_dir
=
'/tmp'
#fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN)
super
(
Connection
,
self
)
.
__init__
(
connection_info
)
super
(
Connection
,
self
)
.
__init__
(
connection_info
,
*
args
,
**
kwargs
)
@property
def
transport
(
self
):
...
...
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