Hello community,

here is the log from the commit of package python-netmiko for openSUSE:Factory 
checked in at 2019-09-13 14:58:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-netmiko (Old)
 and      /work/SRC/openSUSE:Factory/.python-netmiko.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-netmiko"

Fri Sep 13 14:58:20 2019 rev:6 rq:730103 version:2.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-netmiko/python-netmiko.changes    
2019-08-06 17:27:14.872688946 +0200
+++ /work/SRC/openSUSE:Factory/.python-netmiko.new.7948/python-netmiko.changes  
2019-09-13 14:58:26.277277539 +0200
@@ -1,0 +2,8 @@
+Wed Sep 11 11:08:13 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 2.4.2:
+  * Fix session_log corruption bug
+  * Add support for ProxyJump in SSH config file
+  * Add support for Linux prompt terminators via environment variables
+
+-------------------------------------------------------------------

Old:
----
  netmiko-2.4.1.tar.gz

New:
----
  netmiko-2.4.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-netmiko.spec ++++++
--- /var/tmp/diff_new_pack.UYmwcy/_old  2019-09-13 14:58:26.813277562 +0200
+++ /var/tmp/diff_new_pack.UYmwcy/_new  2019-09-13 14:58:26.813277562 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-netmiko
-Version:        2.4.1
+Version:        2.4.2
 Release:        0
 Summary:        Multi-vendor library to simplify Paramiko SSH connections to 
network devices
 License:        MIT

++++++ netmiko-2.4.1.tar.gz -> netmiko-2.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/PKG-INFO new/netmiko-2.4.2/PKG-INFO
--- old/netmiko-2.4.1/PKG-INFO  2019-07-25 23:15:47.000000000 +0200
+++ new/netmiko-2.4.2/PKG-INFO  2019-09-07 20:23:55.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: netmiko
-Version: 2.4.1
+Version: 2.4.2
 Summary: Multi-vendor library to simplify Paramiko SSH connections to network 
devices
 Home-page: https://github.com/ktbyers/netmiko
 Author: Kirk Byers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/__init__.py 
new/netmiko-2.4.2/netmiko/__init__.py
--- old/netmiko-2.4.1/netmiko/__init__.py       2019-07-25 23:12:55.000000000 
+0200
+++ new/netmiko-2.4.2/netmiko/__init__.py       2019-09-07 20:22:43.000000000 
+0200
@@ -23,7 +23,7 @@
 NetmikoAuthError = NetMikoAuthenticationException
 Netmiko = ConnectHandler
 
-__version__ = "2.4.1"
+__version__ = "2.4.2"
 __all__ = (
     "ConnectHandler",
     "ssh_dispatcher",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/base_connection.py 
new/netmiko-2.4.2/netmiko/base_connection.py
--- old/netmiko-2.4.1/netmiko/base_connection.py        2019-07-25 
23:12:55.000000000 +0200
+++ new/netmiko-2.4.2/netmiko/base_connection.py        2019-09-07 
20:22:43.000000000 +0200
@@ -403,6 +403,11 @@
 
     def _write_session_log(self, data):
         if self.session_log is not None and len(data) > 0:
+            # Hide the password and secret in the session_log
+            if self.password:
+                data = data.replace(self.password, "********")
+            if self.secret:
+                data = data.replace(self.secret, "********")
             self.session_log.write(write_bytes(data, encoding=self.encoding))
             self.session_log.flush()
 
@@ -776,10 +781,20 @@
         else:
             source = {}
 
+        # Keys get normalized to lower-case
         if "proxycommand" in source:
             proxy = paramiko.ProxyCommand(source["proxycommand"])
-        elif "ProxyCommand" in source:
-            proxy = paramiko.ProxyCommand(source["ProxyCommand"])
+        elif "proxyjump" in source:
+            hops = list(reversed(source["proxyjump"].split(",")))
+            if len(hops) > 1:
+                raise ValueError(
+                    "ProxyJump with more than one proxy server is not 
supported."
+                )
+            port = source.get("port", self.port)
+            host = source.get("hostname", self.host)
+            # -F {full_path} forces the continued use of the same SSH config 
file
+            cmd = "ssh -F {} -W {}:{} {}".format(full_path, host, port, 
hops[0])
+            proxy = paramiko.ProxyCommand(cmd)
         else:
             proxy = None
 
@@ -939,7 +954,7 @@
 
         # check if data was ever present
         if new_data:
-            return ""
+            return new_data
         else:
             raise NetMikoTimeoutException("Timed out waiting for data")
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/hp/hp_procurve.py 
new/netmiko-2.4.2/netmiko/hp/hp_procurve.py
--- old/netmiko-2.4.1/netmiko/hp/hp_procurve.py 2019-07-08 00:01:32.000000000 
+0200
+++ new/netmiko-2.4.2/netmiko/hp/hp_procurve.py 2019-09-07 20:22:43.000000000 
+0200
@@ -3,10 +3,20 @@
 import re
 import time
 import socket
+from os import path
+from paramiko import SSHClient
 from netmiko.cisco_base_connection import CiscoSSHConnection
 from netmiko import log
 
 
+class SSHClient_noauth(SSHClient):
+    """Set noauth when manually handling SSH authentication."""
+
+    def _auth(self, username, *args):
+        self._transport.auth_none(username)
+        return
+
+
 class HPProcurveBase(CiscoSSHConnection):
     def session_preparation(self):
         """
@@ -99,6 +109,25 @@
 
         super(HPProcurveSSH, self).session_preparation()
 
+    def _build_ssh_client(self):
+        """Allow passwordless authentication for HP devices being 
provisioned."""
+
+        # Create instance of SSHClient object. If no SSH keys and no password, 
then use noauth
+        if not self.use_keys and not self.password:
+            remote_conn_pre = SSHClient_noauth()
+        else:
+            remote_conn_pre = SSHClient()
+
+        # Load host_keys for better SSH security
+        if self.system_host_keys:
+            remote_conn_pre.load_system_host_keys()
+        if self.alt_host_keys and path.isfile(self.alt_key_file):
+            remote_conn_pre.load_host_keys(self.alt_key_file)
+
+        # Default is to automatically add untrusted hosts (make sure 
appropriate for your env)
+        remote_conn_pre.set_missing_host_key_policy(self.key_policy)
+        return remote_conn_pre
+
 
 class HPProcurveTelnet(HPProcurveBase):
     def telnet_login(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/keymile/__init__.py 
new/netmiko-2.4.2/netmiko/keymile/__init__.py
--- old/netmiko-2.4.1/netmiko/keymile/__init__.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/netmiko-2.4.2/netmiko/keymile/__init__.py       2019-09-07 
20:22:43.000000000 +0200
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+from netmiko.keymile.keymile_ssh import KeymileSSH
+from netmiko.keymile.keymile_nos_ssh import KeymileNOSSSH
+
+__all__ = ["KeymileSSH", "KeymileNOSSSH"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/keymile/keymile_nos_ssh.py 
new/netmiko-2.4.2/netmiko/keymile/keymile_nos_ssh.py
--- old/netmiko-2.4.1/netmiko/keymile/keymile_nos_ssh.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/netmiko-2.4.2/netmiko/keymile/keymile_nos_ssh.py        2019-09-07 
20:22:43.000000000 +0200
@@ -0,0 +1,38 @@
+import time
+import re
+
+
+from netmiko.cisco.cisco_ios import CiscoIosBase
+from netmiko.ssh_exception import NetMikoAuthenticationException
+
+
+class KeymileNOSSSH(CiscoIosBase):
+    def session_preparation(self):
+        """Prepare the session after the connection has been established."""
+        self.set_base_prompt()
+        self.disable_paging()
+        time.sleep(0.3 * self.global_delay_factor)
+        self.clear_buffer()
+
+    def _test_channel_read(self, count=40, pattern=""):
+        """Since Keymile NOS always returns True on paramiko.connect() we
+        check the output for substring Login incorrect after connecting."""
+        output = super(KeymileNOSSSH, self)._test_channel_read(
+            count=count, pattern=pattern
+        )
+        pattern = r"Login incorrect"
+        if re.search(pattern, output):
+            self.paramiko_cleanup()
+            msg = "Authentication failure: unable to connect"
+            msg += "{device_type} {host}:{port}".format(
+                device_type=self.device_type, host=self.host, port=self.port
+            )
+            msg += self.RESPONSE_RETURN + "Login incorrect"
+            raise NetMikoAuthenticationException(msg)
+        else:
+            return output
+
+    def special_login_handler(self, delay_factor=1):
+        """Since Keymile NOS always returns True on paramiko.connect() we
+        check the output for substring Login incorrect after connecting."""
+        self._test_channel_read(pattern=r"(>|Login incorrect)")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/keymile/keymile_ssh.py 
new/netmiko-2.4.2/netmiko/keymile/keymile_ssh.py
--- old/netmiko-2.4.1/netmiko/keymile/keymile_ssh.py    1970-01-01 
01:00:00.000000000 +0100
+++ new/netmiko-2.4.2/netmiko/keymile/keymile_ssh.py    2019-09-07 
20:22:43.000000000 +0200
@@ -0,0 +1,56 @@
+import time
+
+from netmiko.cisco.cisco_ios import CiscoIosBase
+
+
+class KeymileSSH(CiscoIosBase):
+    def __init__(self, **kwargs):
+        kwargs.setdefault("default_enter", "\r\n")
+        return super(KeymileSSH, self).__init__(**kwargs)
+
+    def session_preparation(self):
+        """Prepare the session after the connection has been established."""
+        self._test_channel_read(pattern=r">")
+        self.set_base_prompt()
+        time.sleep(0.3 * self.global_delay_factor)
+        self.clear_buffer()
+
+    def disable_paging(self, *args, **kwargs):
+        """Keymile does not use paging."""
+        return ""
+
+    def check_config_mode(self, *args, **kwargs):
+        """Keymile does not use config mode."""
+        return False
+
+    def config_mode(self, *args, **kwargs):
+        """Keymile does not use config mode."""
+        return ""
+
+    def exit_config_mode(self, *args, **kwargs):
+        """Keymile does not use config mode."""
+        return ""
+
+    def check_enable_mode(self, *args, **kwargs):
+        """Keymile does not use enable mode."""
+        return False
+
+    def enable(self, *args, **kwargs):
+        """Keymile does not use enable mode."""
+        return ""
+
+    def exit_enable_mode(self, *args, **kwargs):
+        """Keymile does not use enable mode."""
+        return ""
+
+    def strip_prompt(self, a_string):
+        """Remove appending empty line and prompt from output"""
+        self._write_session_log(a_string)
+        a_string = a_string[:-1]
+        return super(KeymileSSH, self).strip_prompt(a_string=a_string)
+
+    def set_base_prompt(self, pri_prompt_terminator=">", **kwargs):
+        """ set prompt termination  to >"""
+        return super(KeymileSSH, self).set_base_prompt(
+            pri_prompt_terminator=pri_prompt_terminator
+        )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/linux/linux_ssh.py 
new/netmiko-2.4.2/netmiko/linux/linux_ssh.py
--- old/netmiko-2.4.1/netmiko/linux/linux_ssh.py        2019-07-08 
00:01:32.000000000 +0200
+++ new/netmiko-2.4.2/netmiko/linux/linux_ssh.py        2019-09-07 
20:22:43.000000000 +0200
@@ -1,5 +1,6 @@
 from __future__ import unicode_literals
 
+import os
 import re
 import socket
 import time
@@ -8,6 +9,10 @@
 from netmiko.cisco_base_connection import CiscoFileTransfer
 from netmiko.ssh_exception import NetMikoTimeoutException
 
+LINUX_PROMPT_PRI = os.getenv("NETMIKO_LINUX_PROMPT_PRI", "$")
+LINUX_PROMPT_ALT = os.getenv("NETMIKO_LINUX_PROMPT_ALT", "#")
+LINUX_PROMPT_ROOT = os.getenv("NETMIKO_LINUX_PROMPT_ROOT", "#")
+
 
 class LinuxSSH(CiscoSSHConnection):
     def session_preparation(self):
@@ -28,7 +33,10 @@
         return ""
 
     def set_base_prompt(
-        self, pri_prompt_terminator="$", alt_prompt_terminator="#", 
delay_factor=1
+        self,
+        pri_prompt_terminator=LINUX_PROMPT_PRI,
+        alt_prompt_terminator=LINUX_PROMPT_ALT,
+        delay_factor=1,
     ):
         """Determine base prompt."""
         return super(LinuxSSH, self).set_base_prompt(
@@ -45,7 +53,7 @@
             config_commands=config_commands, 
exit_config_mode=exit_config_mode, **kwargs
         )
 
-    def check_config_mode(self, check_string="#"):
+    def check_config_mode(self, check_string=LINUX_PROMPT_ROOT):
         """Verify root"""
         return self.check_enable_mode(check_string=check_string)
 
@@ -56,7 +64,7 @@
     def exit_config_mode(self, exit_config="exit"):
         return self.exit_enable_mode(exit_command=exit_config)
 
-    def check_enable_mode(self, check_string="#"):
+    def check_enable_mode(self, check_string=LINUX_PROMPT_ROOT):
         """Verify root"""
         return super(LinuxSSH, 
self).check_enable_mode(check_string=check_string)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko/ssh_dispatcher.py 
new/netmiko-2.4.2/netmiko/ssh_dispatcher.py
--- old/netmiko-2.4.1/netmiko/ssh_dispatcher.py 2019-07-25 23:12:55.000000000 
+0200
+++ new/netmiko-2.4.2/netmiko/ssh_dispatcher.py 2019-09-07 20:22:43.000000000 
+0200
@@ -55,6 +55,7 @@
 from netmiko.ipinfusion import IpInfusionOcNOSSSH, IpInfusionOcNOSTelnet
 from netmiko.juniper import JuniperSSH, JuniperTelnet
 from netmiko.juniper import JuniperFileTransfer
+from netmiko.keymile import KeymileSSH, KeymileNOSSSH
 from netmiko.linux import LinuxSSH, LinuxFileTransfer
 from netmiko.mikrotik import MikrotikRouterOsSSH
 from netmiko.mikrotik import MikrotikSwitchOsSSH
@@ -139,6 +140,8 @@
     "ipinfusion_ocnos": IpInfusionOcNOSSSH,
     "juniper": JuniperSSH,
     "juniper_junos": JuniperSSH,
+    "keymile": KeymileSSH,
+    "keymile_nos": KeymileNOSSSH,
     "linux": LinuxSSH,
     "mikrotik_routeros": MikrotikRouterOsSSH,
     "mikrotik_switchos": MikrotikSwitchOsSSH,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko.egg-info/PKG-INFO 
new/netmiko-2.4.2/netmiko.egg-info/PKG-INFO
--- old/netmiko-2.4.1/netmiko.egg-info/PKG-INFO 2019-07-25 23:15:47.000000000 
+0200
+++ new/netmiko-2.4.2/netmiko.egg-info/PKG-INFO 2019-09-07 20:23:55.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: netmiko
-Version: 2.4.1
+Version: 2.4.2
 Summary: Multi-vendor library to simplify Paramiko SSH connections to network 
devices
 Home-page: https://github.com/ktbyers/netmiko
 Author: Kirk Byers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netmiko-2.4.1/netmiko.egg-info/SOURCES.txt 
new/netmiko-2.4.2/netmiko.egg-info/SOURCES.txt
--- old/netmiko-2.4.1/netmiko.egg-info/SOURCES.txt      2019-07-25 
23:15:47.000000000 +0200
+++ new/netmiko-2.4.2/netmiko.egg-info/SOURCES.txt      2019-09-07 
20:23:55.000000000 +0200
@@ -98,6 +98,9 @@
 netmiko/ipinfusion/ipinfusion_ocnos.py
 netmiko/juniper/__init__.py
 netmiko/juniper/juniper.py
+netmiko/keymile/__init__.py
+netmiko/keymile/keymile_nos_ssh.py
+netmiko/keymile/keymile_ssh.py
 netmiko/linux/__init__.py
 netmiko/linux/linux_ssh.py
 netmiko/mellanox/__init__.py


Reply via email to