From be9f71b09d4a9d94c4148ae2b9464193c263f8da Mon Sep 17 00:00:00 2001 From: ngkotsis Date: Tue, 25 Apr 2017 08:47:54 +0300 Subject: [PATCH] handle look_for_keys parameter when establishing an ssh connection (#8) --- src/NcclientLibrary/NcclientKeywords.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/NcclientLibrary/NcclientKeywords.py b/src/NcclientLibrary/NcclientKeywords.py index bdb25ac..21b8e4d 100644 --- a/src/NcclientLibrary/NcclientKeywords.py +++ b/src/NcclientLibrary/NcclientKeywords.py @@ -63,7 +63,21 @@ def __init__(self): def connect(self, *args, **kwds): """ Initialize a Manager over the SSH transport. + + ``host`` the host to connect to + + ``port`` the SSH port + + ``username`` the username to use for SSH authentication + + ``password`` the password to be used for password authentication + + ``look_for_keys`` set to ``false`` to avoid searching for ssh keys + + ``key_filename`` a filename where a private key can be found + """ + try: logger.info('Creating session %s, %s' % (args, kwds)) alias = kwds.get('alias') @@ -73,6 +87,7 @@ def connect(self, *args, **kwds): username=str(kwds.get('username')), password=str(kwds.get('password')), hostkey_verify=False, + look_for_keys= False if str(kwds.get('look_for_keys')).lower() == 'false' else True, key_filename=str(kwds.get('key_filename')), ) self._cache.register(session, alias=alias)