Skip to content

Commit 1c877db

Browse files
author
Pan
committed
Added host argument to all exceptions - resolves #116.
Updated copyright info. Updated requirements, setup.py. Updated manylinux wheel build, travis cfg. Added tests for import backwards compatibility post refactor.
1 parent feb094e commit 1c877db

32 files changed

+360
-108
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "libssh2"]
22
path = libssh2
3-
url = https://github.com/libssh2/libssh2.git
3+
url = https://github.com/ParallelSSH/libssh2.git

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ install:
2424
- pip install -r requirements_dev.txt
2525
script:
2626
- export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu
27+
# For testing SSH agent related functionality
28+
- eval `ssh-agent -s`
2729
- nosetests --with-coverage --cover-package=pssh
2830
- flake8 pssh
2931
- cd doc; make html; cd ..
@@ -140,8 +142,7 @@ jobs:
140142
# on:
141143
# repo: ParallelSSH/parallel-ssh
142144
# tags: true
143-
- stage: build and deploy source and wheels
144-
if: tag IS present
145+
- stage: build wheels
145146
os: linux
146147
python: 3.6
147148
before_install: skip

Changelog.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
Change Log
22
============
33

4+
1.6.0
5+
++++++
6+
7+
Changes
8+
--------
9+
10+
* Upgrade embedded ``libssh2`` in binary wheels to latest version plus enhancements.
11+
* Adds support for ECDSA host keys for native client.
12+
* Adds support for SHA-256 host key fingerprints for native client.
13+
* Added SSH agent forwarding to native client, defaults to on as per paramiko client - ``forward_ssh_agent`` keyword parameter.
14+
* Windows wheels switched to OpenSSL back end for native client.
15+
* Windows wheels include zlib and have compression enabled for native client.
16+
17+
Fixes
18+
------
19+
20+
* Windows native client could not connect to newer SSH servers - thanks Pavel.
21+
22+
Note - changes apply to binary wheels only. See building from source instructions to make system packages.
23+
424
1.5.5
525
++++++
626

ci/docker/manylinux/Dockerfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
FROM quay.io/pypa/manylinux1_x86_64
22

3-
ENV CMAKE cmake-2.8.12.2-Linux-i386
4-
ENV OPENSSL openssl-1.0.2o
5-
ENV LIBSSH2 libssh2-1.8.0
3+
ENV CMAKE cmake-2.8.11.1-5.4.x86_64
4+
ENV OPENSSL openssl-1.0.2l
5+
ENV LIBSSH2_VER agent_fwd
66

77
RUN yum install zlib-devel -y
88

9-
# Cmake
10-
RUN wget --no-check-certificate https://cmake.org/files/v2.8/${CMAKE}.tar.gz && \
11-
tar -xzf ${CMAKE}.tar.gz && cp -af ${CMAKE}/share/* /usr/share/ && \
12-
cp -af ${CMAKE}/bin/* /usr/bin/
9+
ADD https://github.com/ParallelSSH/libssh2/archive/${LIBSSH2_VER}.tar.gz libssh2.tar.gz
10+
ADD ${CMAKE}.rpm cmake.rpm
11+
ADD http://www.openssl.org/source/${OPENSSL}.tar.gz ${OPENSSL}.tar.gz
12+
13+
RUN rpm -i cmake.rpm
1314

1415
# Openssl
15-
RUN wget --no-check-certificate http://www.openssl.org/source/${OPENSSL}.tar.gz && \
16-
tar -xzf ${OPENSSL}.tar.gz && \
16+
RUN tar -xzf ${OPENSSL}.tar.gz && \
1717
cd ${OPENSSL} && \
1818
./config --prefix=/usr --openssldir=/usr/openssl threads shared && \
1919
make -j4 && make install
2020

2121
# Libssh2
22-
RUN wget --no-check-certificate https://www.libssh2.org/download/${LIBSSH2}.tar.gz && \
23-
tar -xzf ${LIBSSH2}.tar.gz
22+
RUN tar -xzf libssh2.tar.gz && \
23+
mkdir -p build_libssh2 && cd build_libssh2 && \
24+
cmake ../libssh2-${LIBSSH2_VER} -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
25+
-DENABLE_CRYPT_NONE=ON -DENABLE_MAC_NONE=ON -DCMAKE_INSTALL_PREFIX=/usr && \
26+
cmake --build . --config Release --target install
2427

25-
RUN cd ${LIBSSH2} && cmake ../${LIBSSH2} -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
26-
-DENABLE_CRYPT_NONE=ON -DENABLE_MAC_NONE=ON -DCMAKE_INSTALL_PREFIX=/usr \
27-
&& cmake --build . --config Release --target install
28+
RUN rm -rf ${OPENSSL}* libssh2-agent_fwd build_libssh2
2829

29-
RUN rm -rf ${CMAKE}* ${OPENSSL}* ${LIBSSH2}*
30+
VOLUME /var/cache
10.8 MB
Binary file not shown.

libssh2

Submodule libssh2 updated 80 files

pssh/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is part of parallel-ssh.
22

3-
# Copyright (C) 2014-2017 Panos Kittenis
3+
# Copyright (C) 2014-2018 Panos Kittenis.
44

55
# This library is free software; you can redistribute it and/or
66
# modify it under the terms of the GNU Lesser General Public

pssh/agent.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is part of parallel-ssh.
22

3-
# Copyright (C) 2014-2017 Panos Kittenis
3+
# Copyright (C) 2014-2018 Panos Kittenis.
44

55
# This library is free software; you can redistribute it and/or
66
# modify it under the terms of the GNU Lesser General Public
@@ -15,32 +15,16 @@
1515
# License along with this library; if not, write to the Free Software
1616
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1717

18-
"""SSH agent module of ParallelSSH"""
18+
"""SSH agent module of parallel-ssh"""
1919

2020
import paramiko.agent
2121

2222

2323
class SSHAgent(paramiko.agent.AgentSSH):
2424
""":py:class:`paramiko.agent.Agent` compatible class for programmatically
25-
supplying an SSH agent"""
25+
supplying an SSH agent."""
2626

2727
def __init__(self):
28-
"""**Example Usage**
29-
30-
.. code-block:: python
31-
32-
from pssh.agent import SSHAgent
33-
from pssh.utils import load_private_key
34-
from pssh import ParallelSSHClient
35-
36-
agent = SSHAgent()
37-
agent.add_key(load_private_key('my_private_key_filename'))
38-
agent.add_key(load_private_key('my_other_private_key_filename'))
39-
hosts = ['my_host', 'my_other_host']
40-
41-
client = ParallelSSHClient(hosts, agent=agent)
42-
client.run_command('uname')
43-
"""
4428
paramiko.agent.AgentSSH.__init__(self)
4529
self._conn = None
4630
self.keys = []

pssh/clients/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# flake8: noqa: F401
1+
# This file is part of parallel-ssh.
2+
3+
# Copyright (C) 2014-2018 Panos Kittenis.
4+
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation, version 2.1.
28

9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
18+
# flake8: noqa: F401
319
from .native.parallel import ParallelSSHClient
420
from .native.single import SSHClient

pssh/clients/base_pssh.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is part of parallel-ssh.
22

3-
# Copyright (C) 2014-2018 Panos Kittenis
3+
# Copyright (C) 2014-2018 Panos Kittenis and contributors.
44

55
# This library is free software; you can redistribute it and/or
66
# modify it under the terms of the GNU Lesser General Public
@@ -135,12 +135,7 @@ def get_output(self, cmd, output):
135135
try:
136136
(channel, host, stdout, stderr, stdin) = cmd.get()
137137
except Exception as ex:
138-
try:
139-
host = ex.args[1]
140-
except IndexError:
141-
logger.error("Got exception with no host argument - "
142-
"cannot update output data with %s", ex)
143-
raise ex
138+
host = ex.host
144139
self._update_host_output(
145140
output, host, None, None, None, None, None, cmd, exception=ex)
146141
raise
@@ -264,9 +259,13 @@ def copy_file(self, local_file, remote_file, recurse=False, copy_args=None):
264259

265260
def _copy_file(self, host, local_file, remote_file, recurse=False):
266261
"""Make sftp client, copy file"""
267-
self._make_ssh_client(host)
268-
return self.host_clients[host].copy_file(local_file, remote_file,
269-
recurse=recurse)
262+
try:
263+
self._make_ssh_client(host)
264+
return self.host_clients[host].copy_file(local_file, remote_file,
265+
recurse=recurse)
266+
except Exception as ex:
267+
ex.host = host
268+
raise ex
270269

271270
def copy_remote_file(self, remote_file, local_file, recurse=False,
272271
suffix_separator='_', copy_args=None, **kwargs):
@@ -351,7 +350,11 @@ def copy_remote_file(self, remote_file, local_file, recurse=False,
351350
def _copy_remote_file(self, host, remote_file, local_file, recurse,
352351
**kwargs):
353352
"""Make sftp client, copy file to local"""
354-
self._make_ssh_client(host)
355-
return self.host_clients[host].copy_remote_file(
356-
remote_file, local_file, recurse=recurse,
357-
**kwargs)
353+
try:
354+
self._make_ssh_client(host)
355+
return self.host_clients[host].copy_remote_file(
356+
remote_file, local_file, recurse=recurse,
357+
**kwargs)
358+
except Exception as ex:
359+
ex.host = host
360+
raise ex

0 commit comments

Comments
 (0)