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
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
31 deletions
+19
-31
v2/ansible/executor/connection_info.py
+4
-5
v2/ansible/executor/process/worker.py
+7
-10
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
...
@@ -48,8 +48,9 @@ class ConnectionInformation:
...
@@ -48,8 +48,9 @@ class ConnectionInformation:
self
.
remote_addr
=
None
self
.
remote_addr
=
None
self
.
remote_user
=
None
self
.
remote_user
=
None
self
.
password
=
passwords
.
get
(
'conn_pass'
,
''
)
self
.
password
=
passwords
.
get
(
'conn_pass'
,
''
)
self
.
port
=
None
self
.
port
=
22
self
.
private_key_file
=
None
self
.
private_key_file
=
C
.
DEFAULT_PRIVATE_KEY_FILE
self
.
timeout
=
C
.
DEFAULT_TIMEOUT
# privilege escalation
# privilege escalation
self
.
become
=
None
self
.
become
=
None
...
@@ -119,9 +120,7 @@ class ConnectionInformation:
...
@@ -119,9 +120,7 @@ class ConnectionInformation:
self
.
connection
=
options
.
connection
self
.
connection
=
options
.
connection
self
.
remote_user
=
options
.
remote_user
self
.
remote_user
=
options
.
remote_user
#if 'port' in options and options.port is not None:
self
.
private_key_file
=
options
.
private_key_file
# self.port = options.port
self
.
private_key_file
=
None
# privilege escalation
# privilege escalation
self
.
become
=
options
.
become
self
.
become
=
options
.
become
...
...
v2/ansible/executor/process/worker.py
View file @
8574d40b
...
@@ -51,7 +51,7 @@ class WorkerProcess(multiprocessing.Process):
...
@@ -51,7 +51,7 @@ class WorkerProcess(multiprocessing.Process):
for reading later.
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:
# takes a task queue manager as the sole param:
self
.
_main_q
=
main_q
self
.
_main_q
=
main_q
...
@@ -59,13 +59,10 @@ class WorkerProcess(multiprocessing.Process):
...
@@ -59,13 +59,10 @@ class WorkerProcess(multiprocessing.Process):
self
.
_loader
=
loader
self
.
_loader
=
loader
# dupe stdin, if we have one
# dupe stdin, if we have one
self
.
_new_stdin
=
sys
.
stdin
try
:
try
:
fileno
=
sys
.
stdin
.
fileno
()
fileno
=
sys
.
stdin
.
fileno
()
except
ValueError
:
if
fileno
is
not
None
:
fileno
=
None
self
.
_new_stdin
=
new_stdin
if
not
new_stdin
and
fileno
is
not
None
:
try
:
try
:
self
.
_new_stdin
=
os
.
fdopen
(
os
.
dup
(
fileno
))
self
.
_new_stdin
=
os
.
fdopen
(
os
.
dup
(
fileno
))
except
OSError
,
e
:
except
OSError
,
e
:
...
@@ -73,9 +70,9 @@ class WorkerProcess(multiprocessing.Process):
...
@@ -73,9 +70,9 @@ class WorkerProcess(multiprocessing.Process):
# not a valid file descriptor, so we just rely on
# not a valid file descriptor, so we just rely on
# using the one that was passed in
# using the one that was passed in
pass
pass
except
ValueError
:
if
self
.
_new_stdin
:
# couldn't get stdin's fileno, so we just carry on
sys
.
stdin
=
self
.
_new_stdin
pass
super
(
WorkerProcess
,
self
)
.
__init__
()
super
(
WorkerProcess
,
self
)
.
__init__
()
...
@@ -118,7 +115,7 @@ class WorkerProcess(multiprocessing.Process):
...
@@ -118,7 +115,7 @@ class WorkerProcess(multiprocessing.Process):
# execute the task and build a TaskResult from the result
# execute the task and build a TaskResult from the result
debug
(
"running TaskExecutor() for
%
s/
%
s"
%
(
host
,
task
))
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
))
debug
(
"done running TaskExecutor() for
%
s/
%
s"
%
(
host
,
task
))
task_result
=
TaskResult
(
host
,
task
,
executor_result
)
task_result
=
TaskResult
(
host
,
task
,
executor_result
)
...
...
v2/ansible/executor/task_executor.py
View file @
8574d40b
...
@@ -45,11 +45,12 @@ class TaskExecutor:
...
@@ -45,11 +45,12 @@ class TaskExecutor:
class.
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
.
_host
=
host
self
.
_task
=
task
self
.
_task
=
task
self
.
_job_vars
=
job_vars
self
.
_job_vars
=
job_vars
self
.
_connection_info
=
connection_info
self
.
_connection_info
=
connection_info
self
.
_new_stdin
=
new_stdin
self
.
_loader
=
loader
self
.
_loader
=
loader
self
.
_module_loader
=
module_loader
self
.
_module_loader
=
module_loader
...
@@ -370,7 +371,7 @@ class TaskExecutor:
...
@@ -370,7 +371,7 @@ class TaskExecutor:
if
conn_type
==
'smart'
:
if
conn_type
==
'smart'
:
conn_type
=
'ssh'
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
:
if
not
connection
:
raise
AnsibleError
(
"the connection plugin '
%
s' was not found"
%
conn_type
)
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:
...
@@ -87,21 +87,10 @@ class TaskQueueManager:
self
.
_workers
=
[]
self
.
_workers
=
[]
for
i
in
range
(
self
.
_options
.
forks
):
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
()
main_q
=
multiprocessing
.
Queue
()
rslt_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
()
prc
.
start
()
self
.
_workers
.
append
((
prc
,
main_q
,
rslt_q
))
self
.
_workers
.
append
((
prc
,
main_q
,
rslt_q
))
...
...
v2/ansible/plugins/connections/__init__.py
View file @
8574d40b
...
@@ -43,10 +43,12 @@ class ConnectionBase:
...
@@ -43,10 +43,12 @@ class ConnectionBase:
has_pipelining
=
False
has_pipelining
=
False
become_methods
=
C
.
BECOME_METHODS
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
# All these hasattrs allow subclasses to override these parameters
if
not
hasattr
(
self
,
'_connection_info'
):
if
not
hasattr
(
self
,
'_connection_info'
):
self
.
_connection_info
=
connection_info
self
.
_connection_info
=
connection_info
if
not
hasattr
(
self
,
'_new_stdin'
):
self
.
_new_stdin
=
new_stdin
if
not
hasattr
(
self
,
'_display'
):
if
not
hasattr
(
self
,
'_display'
):
self
.
_display
=
Display
(
verbosity
=
connection_info
.
verbosity
)
self
.
_display
=
Display
(
verbosity
=
connection_info
.
verbosity
)
if
not
hasattr
(
self
,
'_connected'
):
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):
...
@@ -50,7 +50,7 @@ class Connection(ConnectionBase):
self
.
_cp_dir
=
'/tmp'
self
.
_cp_dir
=
'/tmp'
#fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN)
#fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN)
super
(
Connection
,
self
)
.
__init__
(
connection_info
)
super
(
Connection
,
self
)
.
__init__
(
connection_info
,
*
args
,
**
kwargs
)
@property
@property
def
transport
(
self
):
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