Skip to content

Commit

Permalink
Netmiko 2.4.2 Release
Browse files Browse the repository at this point in the history
Netmiko 2.4.2 Release
  • Loading branch information
ktbyers authored Sep 7, 2019
2 parents 134cd33 + 7e493b8 commit 2f5a75b
Show file tree
Hide file tree
Showing 27 changed files with 1,949 additions and 37 deletions.
42 changes: 36 additions & 6 deletions docs/netmiko/base_connection.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ <h1 class="title">Module <code>netmiko.base_connection</code></h1>

def _write_session_log(self, data):
if self.session_log is not None and len(data) &gt; 0:
# Hide the password and secret in the session_log
if self.password:
data = data.replace(self.password, &#34;********&#34;)
if self.secret:
data = data.replace(self.secret, &#34;********&#34;)
self.session_log.write(write_bytes(data, encoding=self.encoding))
self.session_log.flush()

Expand Down Expand Up @@ -804,10 +809,20 @@ <h1 class="title">Module <code>netmiko.base_connection</code></h1>
else:
source = {}

# Keys get normalized to lower-case
if &#34;proxycommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;proxycommand&#34;])
elif &#34;ProxyCommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;ProxyCommand&#34;])
elif &#34;proxyjump&#34; in source:
hops = list(reversed(source[&#34;proxyjump&#34;].split(&#34;,&#34;)))
if len(hops) &gt; 1:
raise ValueError(
&#34;ProxyJump with more than one proxy server is not supported.&#34;
)
port = source.get(&#34;port&#34;, self.port)
host = source.get(&#34;hostname&#34;, self.host)
# -F {full_path} forces the continued use of the same SSH config file
cmd = &#34;ssh -F {} -W {}:{} {}&#34;.format(full_path, host, port, hops[0])
proxy = paramiko.ProxyCommand(cmd)
else:
proxy = None

Expand Down Expand Up @@ -967,7 +982,7 @@ <h1 class="title">Module <code>netmiko.base_connection</code></h1>

# check if data was ever present
if new_data:
return &#34;&#34;
return new_data
else:
raise NetMikoTimeoutException(&#34;Timed out waiting for data&#34;)

Expand Down Expand Up @@ -2282,6 +2297,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>

def _write_session_log(self, data):
if self.session_log is not None and len(data) &gt; 0:
# Hide the password and secret in the session_log
if self.password:
data = data.replace(self.password, &#34;********&#34;)
if self.secret:
data = data.replace(self.secret, &#34;********&#34;)
self.session_log.write(write_bytes(data, encoding=self.encoding))
self.session_log.flush()

Expand Down Expand Up @@ -2655,10 +2675,20 @@ <h2 class="section-title" id="header-classes">Classes</h2>
else:
source = {}

# Keys get normalized to lower-case
if &#34;proxycommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;proxycommand&#34;])
elif &#34;ProxyCommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;ProxyCommand&#34;])
elif &#34;proxyjump&#34; in source:
hops = list(reversed(source[&#34;proxyjump&#34;].split(&#34;,&#34;)))
if len(hops) &gt; 1:
raise ValueError(
&#34;ProxyJump with more than one proxy server is not supported.&#34;
)
port = source.get(&#34;port&#34;, self.port)
host = source.get(&#34;hostname&#34;, self.host)
# -F {full_path} forces the continued use of the same SSH config file
cmd = &#34;ssh -F {} -W {}:{} {}&#34;.format(full_path, host, port, hops[0])
proxy = paramiko.ProxyCommand(cmd)
else:
proxy = None

Expand Down Expand Up @@ -2818,7 +2848,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>

# check if data was ever present
if new_data:
return &#34;&#34;
return new_data
else:
raise NetMikoTimeoutException(&#34;Timed out waiting for data&#34;)

Expand Down
2 changes: 2 additions & 0 deletions docs/netmiko/cisco/cisco_ios.html
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ <h3>Subclasses</h3>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosSSH" href="#netmiko.cisco.cisco_ios.CiscoIosSSH">CiscoIosSSH</a></li>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosTelnet" href="#netmiko.cisco.cisco_ios.CiscoIosTelnet">CiscoIosTelnet</a></li>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosSerial" href="#netmiko.cisco.cisco_ios.CiscoIosSerial">CiscoIosSerial</a></li>
<li><a title="netmiko.keymile.keymile_ssh.KeymileSSH" href="../keymile/keymile_ssh.html#netmiko.keymile.keymile_ssh.KeymileSSH">KeymileSSH</a></li>
<li><a title="netmiko.keymile.keymile_nos_ssh.KeymileNOSSSH" href="../keymile/keymile_nos_ssh.html#netmiko.keymile.keymile_nos_ssh.KeymileNOSSSH">KeymileNOSSSH</a></li>
</ul>
<h3>Methods</h3>
<dl>
Expand Down
2 changes: 2 additions & 0 deletions docs/netmiko/cisco/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ <h3>Subclasses</h3>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosSSH" href="cisco_ios.html#netmiko.cisco.cisco_ios.CiscoIosSSH">CiscoIosSSH</a></li>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosTelnet" href="cisco_ios.html#netmiko.cisco.cisco_ios.CiscoIosTelnet">CiscoIosTelnet</a></li>
<li><a title="netmiko.cisco.cisco_ios.CiscoIosSerial" href="cisco_ios.html#netmiko.cisco.cisco_ios.CiscoIosSerial">CiscoIosSerial</a></li>
<li><a title="netmiko.keymile.keymile_ssh.KeymileSSH" href="../keymile/keymile_ssh.html#netmiko.keymile.keymile_ssh.KeymileSSH">KeymileSSH</a></li>
<li><a title="netmiko.keymile.keymile_nos_ssh.KeymileNOSSSH" href="../keymile/keymile_nos_ssh.html#netmiko.keymile.keymile_nos_ssh.KeymileNOSSSH">KeymileNOSSSH</a></li>
</ul>
<h3>Methods</h3>
<dl>
Expand Down
74 changes: 73 additions & 1 deletion docs/netmiko/hp/hp_procurve.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ <h1 class="title">Module <code>netmiko.hp.hp_procurve</code></h1>
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):
&#34;&#34;&#34;Set noauth when manually handling SSH authentication.&#34;&#34;&#34;

def _auth(self, username, *args):
self._transport.auth_none(username)
return


class HPProcurveBase(CiscoSSHConnection):
def session_preparation(self):
&#34;&#34;&#34;
Expand Down Expand Up @@ -123,6 +133,25 @@ <h1 class="title">Module <code>netmiko.hp.hp_procurve</code></h1>

super(HPProcurveSSH, self).session_preparation()

def _build_ssh_client(self):
&#34;&#34;&#34;Allow passwordless authentication for HP devices being provisioned.&#34;&#34;&#34;

# 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(
Expand Down Expand Up @@ -621,7 +650,26 @@ <h3>Inherited members</h3>
# Try one last time to past &#34;Press any key to continue
self.write_channel(self.RETURN)

super(HPProcurveSSH, self).session_preparation()</code></pre>
super(HPProcurveSSH, self).session_preparation()

def _build_ssh_client(self):
&#34;&#34;&#34;Allow passwordless authentication for HP devices being provisioned.&#34;&#34;&#34;

# 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</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
Expand Down Expand Up @@ -907,6 +955,27 @@ <h3>Inherited members</h3>
</li>
</ul>
</dd>
<dt id="netmiko.hp.hp_procurve.SSHClient_noauth"><code class="flex name class">
<span>class <span class="ident">SSHClient_noauth</span></span>
</code></dt>
<dd>
<section class="desc"><p>Set noauth when manually handling SSH authentication.</p>
<p>Create a new SSHClient.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">class SSHClient_noauth(SSHClient):
&#34;&#34;&#34;Set noauth when manually handling SSH authentication.&#34;&#34;&#34;

def _auth(self, username, *args):
self._transport.auth_none(username)
return</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li>paramiko.client.SSHClient</li>
<li>paramiko.util.ClosingContextManager</li>
</ul>
</dd>
</dl>
</section>
</article>
Expand Down Expand Up @@ -940,6 +1009,9 @@ <h4><code><a title="netmiko.hp.hp_procurve.HPProcurveTelnet" href="#netmiko.hp.h
<li><code><a title="netmiko.hp.hp_procurve.HPProcurveTelnet.telnet_login" href="#netmiko.hp.hp_procurve.HPProcurveTelnet.telnet_login">telnet_login</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="netmiko.hp.hp_procurve.SSHClient_noauth" href="#netmiko.hp.hp_procurve.SSHClient_noauth">SSHClient_noauth</a></code></h4>
</li>
</ul>
</li>
</ul>
Expand Down
21 changes: 20 additions & 1 deletion docs/netmiko/hp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,26 @@ <h3>Inherited members</h3>
# Try one last time to past &#34;Press any key to continue
self.write_channel(self.RETURN)

super(HPProcurveSSH, self).session_preparation()</code></pre>
super(HPProcurveSSH, self).session_preparation()

def _build_ssh_client(self):
&#34;&#34;&#34;Allow passwordless authentication for HP devices being provisioned.&#34;&#34;&#34;

# 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</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
Expand Down
28 changes: 24 additions & 4 deletions docs/netmiko/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="title">Module <code>netmiko</code></h1>
NetmikoAuthError = NetMikoAuthenticationException
Netmiko = ConnectHandler

__version__ = &#34;2.4.1&#34;
__version__ = &#34;2.4.2&#34;
__all__ = (
&#34;ConnectHandler&#34;,
&#34;ssh_dispatcher&#34;,
Expand Down Expand Up @@ -181,6 +181,10 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dd>
<section class="desc"></section>
</dd>
<dt><code class="name"><a title="netmiko.keymile" href="keymile/index.html">netmiko.keymile</a></code></dt>
<dd>
<section class="desc"></section>
</dd>
<dt><code class="name"><a title="netmiko.linux" href="linux/index.html">netmiko.linux</a></code></dt>
<dd>
<section class="desc"></section>
Expand Down Expand Up @@ -975,6 +979,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>

def _write_session_log(self, data):
if self.session_log is not None and len(data) &gt; 0:
# Hide the password and secret in the session_log
if self.password:
data = data.replace(self.password, &#34;********&#34;)
if self.secret:
data = data.replace(self.secret, &#34;********&#34;)
self.session_log.write(write_bytes(data, encoding=self.encoding))
self.session_log.flush()

Expand Down Expand Up @@ -1348,10 +1357,20 @@ <h2 class="section-title" id="header-classes">Classes</h2>
else:
source = {}

# Keys get normalized to lower-case
if &#34;proxycommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;proxycommand&#34;])
elif &#34;ProxyCommand&#34; in source:
proxy = paramiko.ProxyCommand(source[&#34;ProxyCommand&#34;])
elif &#34;proxyjump&#34; in source:
hops = list(reversed(source[&#34;proxyjump&#34;].split(&#34;,&#34;)))
if len(hops) &gt; 1:
raise ValueError(
&#34;ProxyJump with more than one proxy server is not supported.&#34;
)
port = source.get(&#34;port&#34;, self.port)
host = source.get(&#34;hostname&#34;, self.host)
# -F {full_path} forces the continued use of the same SSH config file
cmd = &#34;ssh -F {} -W {}:{} {}&#34;.format(full_path, host, port, hops[0])
proxy = paramiko.ProxyCommand(cmd)
else:
proxy = None

Expand Down Expand Up @@ -1511,7 +1530,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>

# check if data was ever present
if new_data:
return &#34;&#34;
return new_data
else:
raise NetMikoTimeoutException(&#34;Timed out waiting for data&#34;)

Expand Down Expand Up @@ -4603,6 +4622,7 @@ <h1>Index</h1>
<li><code><a title="netmiko.huawei" href="huawei/index.html">netmiko.huawei</a></code></li>
<li><code><a title="netmiko.ipinfusion" href="ipinfusion/index.html">netmiko.ipinfusion</a></code></li>
<li><code><a title="netmiko.juniper" href="juniper/index.html">netmiko.juniper</a></code></li>
<li><code><a title="netmiko.keymile" href="keymile/index.html">netmiko.keymile</a></code></li>
<li><code><a title="netmiko.linux" href="linux/index.html">netmiko.linux</a></code></li>
<li><code><a title="netmiko.mellanox" href="mellanox/index.html">netmiko.mellanox</a></code></li>
<li><code><a title="netmiko.mikrotik" href="mikrotik/index.html">netmiko.mikrotik</a></code></li>
Expand Down
Loading

0 comments on commit 2f5a75b

Please sign in to comment.