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
4c83c274
Commit
4c83c274
authored
Oct 25, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't close paramiko SFTP multiple times in the same runner pass. Noticeable performance increase.
parent
8b50ad7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
lib/ansible/runner/connection_plugins/paramiko_ssh.py
+6
-6
No files found.
lib/ansible/runner/connection_plugins/paramiko_ssh.py
View file @
4c83c274
...
@@ -135,29 +135,29 @@ class Connection(object):
...
@@ -135,29 +135,29 @@ class Connection(object):
if
not
os
.
path
.
exists
(
in_path
):
if
not
os
.
path
.
exists
(
in_path
):
raise
errors
.
AnsibleFileNotFound
(
"file or module does not exist:
%
s"
%
in_path
)
raise
errors
.
AnsibleFileNotFound
(
"file or module does not exist:
%
s"
%
in_path
)
try
:
try
:
sftp
=
self
.
ssh
.
open_sftp
()
s
elf
.
s
ftp
=
self
.
ssh
.
open_sftp
()
except
:
except
:
raise
errors
.
AnsibleError
(
"failed to open a SFTP connection"
)
raise
errors
.
AnsibleError
(
"failed to open a SFTP connection"
)
try
:
try
:
sftp
.
put
(
in_path
,
out_path
)
s
elf
.
s
ftp
.
put
(
in_path
,
out_path
)
except
IOError
:
except
IOError
:
raise
errors
.
AnsibleError
(
"failed to transfer file to
%
s"
%
out_path
)
raise
errors
.
AnsibleError
(
"failed to transfer file to
%
s"
%
out_path
)
sftp
.
close
()
def
fetch_file
(
self
,
in_path
,
out_path
):
def
fetch_file
(
self
,
in_path
,
out_path
):
''' save a remote file to the specified path '''
''' save a remote file to the specified path '''
vvv
(
"FETCH
%
s TO
%
s"
%
(
in_path
,
out_path
),
host
=
self
.
host
)
vvv
(
"FETCH
%
s TO
%
s"
%
(
in_path
,
out_path
),
host
=
self
.
host
)
try
:
try
:
sftp
=
self
.
ssh
.
open_sftp
()
s
elf
.
s
ftp
=
self
.
ssh
.
open_sftp
()
except
:
except
:
raise
errors
.
AnsibleError
(
"failed to open a SFTP connection"
)
raise
errors
.
AnsibleError
(
"failed to open a SFTP connection"
)
try
:
try
:
sftp
.
get
(
in_path
,
out_path
)
s
elf
.
s
ftp
.
get
(
in_path
,
out_path
)
except
IOError
:
except
IOError
:
raise
errors
.
AnsibleError
(
"failed to transfer file from
%
s"
%
in_path
)
raise
errors
.
AnsibleError
(
"failed to transfer file from
%
s"
%
in_path
)
sftp
.
close
()
def
close
(
self
):
def
close
(
self
):
''' terminate the connection '''
''' terminate the connection '''
if
self
.
sftp
is
not
None
:
self
.
sftp
.
close
()
self
.
ssh
.
close
()
self
.
ssh
.
close
()
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