Skip to content

Commit

Permalink
Deal with any exception during accept in server.
Browse files Browse the repository at this point in the history
  • Loading branch information
choppsv1 committed Jan 17, 2018
1 parent 904bfcd commit 80035fd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ doc:
clean:
find . -name '*.pyc' -exec rm {} +
$(PYTHON) setup.py clean
rm -rf doc/build bulid
rm -rf doc/build build

install:
$(PIP) install -e .
Expand Down
6 changes: 1 addition & 5 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
.. January 15 2018, Christian Hopps <[email protected]>
..
.. sshutil documentation master file
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
sshutil
=======

`sshutil` Supports caching authenticated ssh connections and provides ease of
`sshutil` supports caching authenticated ssh connections and provides ease of
use methods to open sessions and run commands on remote hosts.

All connections are by default cached for a short time so no extra work is
Expand Down
10 changes: 3 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,18 @@ packages =
setup-hooks =
pbr.hooks.setup_hook

[wheel]
universal = 1

[pbr]
# autodoc_tree_index_modules = True
autodoc_index_modules = True
# autodoc_excludes =
# setup.py
# tests/

[build_sphinx]
all-files = 1
build-dir = doc/build
source-dir = doc/source
warning-is-error = 1

[wheel]
universal = 1

[nosetests]
verbosity=1
with-doctest=1
Expand Down
10 changes: 10 additions & 0 deletions sshutil/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ def _accept_socket_thread(self, proto_sock):
except ssh.AuthenticationException as error:
logger.debug("%s: Client auth failed: %s: %s: %s", str(self), str(client),
str(addr), str(error))
except EOFError as error:
logger.debug("%s: Client closed the connection during accept: %s: %s: %s",
str(self), str(client), str(addr), str(error))
except Exception as error:
if self.debug:
logger.error("%s: Unexpected exception during accept: %s: %s",
str(self), str(error), traceback.format_exc())
else:
logger.error("%s: Unexpected exception during accept: %s closing",
str(self), str(error))

except Exception as error:
if self.debug:
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[tox]
#envlist = py27,py33,py34,py35,pypy,pypy3
envlist = py27,py36
platform = linux2|darwin

[testenv]
commands = py.test
commands = python -m pytest
deps = pytest
passenv = HOME USER SSH_AUTH_SOCK TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
setenv = OBJDIR={envtmpdir}
Expand All @@ -17,14 +16,14 @@ whitelist_externals = test
deps = coveralls
coverage
{[testenv]deps}
commands = coverage run {envbindir}/pytest
commands = coverage run -m pytest
bash -c '[ -n "{env:TRAVIS:}" ] && coveralls || exit 0'
bash -c '[ -z "{env:TRAVIS:}" ] && coverage report -i --omit=.tox* || exit 0'

[testenv:py36]
deps = coveralls
coverage
{[testenv]deps}
commands = coverage run {envbindir}/pytest
commands = coverage run -m pytest
bash -c '[ -n "{env:TRAVIS:}" ] && coveralls || exit 0'
bash -c '[ -z "{env:TRAVIS:}" ] && coverage report -i --omit=.tox* || exit 0'

0 comments on commit 80035fd

Please sign in to comment.