rename package
This commit is contained in:
parent
950b88a2ea
commit
65b2a5da0b
21
README.md
21
README.md
@ -1,15 +1,16 @@
|
||||
# Conn
|
||||
|
||||
Conn is a ssh and telnet connection manager and automation module
|
||||
Connpy is a ssh and telnet connection manager and automation module
|
||||
|
||||
## Installation
|
||||
|
||||
pip install conn
|
||||
pip install connpy
|
||||
|
||||
## Automation module usage
|
||||
### Standalone module
|
||||
```
|
||||
import conn
|
||||
router = conn.node("unique name","ip/hostname", user="username", password="password")
|
||||
import connpy
|
||||
router = connpy.node("unique name","ip/hostname", user="username", password="password")
|
||||
router.run(["term len 0","show run"])
|
||||
print(router.output)
|
||||
hasip = router.test("show ip int brief","1.1.1.1")
|
||||
@ -21,17 +22,17 @@ else:
|
||||
|
||||
### Using manager configuration
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
device = conf.getitem("router@office")
|
||||
router = conn.node("unique name", **device, config=conf)
|
||||
router = connpy.node("unique name", **device, config=conf)
|
||||
result = router.run("show ip int brief")
|
||||
print(result)
|
||||
```
|
||||
### Running parallel tasks on multiple devices
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
#You can get the nodes from the config from a folder and fitlering in it
|
||||
nodes = conf.getitem("@office", ["router1", "router2", "router3"])
|
||||
#You can also get each node individually:
|
||||
@ -45,7 +46,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": "username", "password": "password
|
||||
nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "password2"}
|
||||
nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "password3"}
|
||||
#Finally you run some tasks on the nodes
|
||||
mynodes = conn.nodes(nodes, config = conf)
|
||||
mynodes = connpy.nodes(nodes, config = conf)
|
||||
result = mynodes.test(["show ip int br"], "1.1.1.2")
|
||||
for i in result:
|
||||
print("---" + i + "---")
|
||||
|
@ -2,7 +2,7 @@
|
||||
'''
|
||||
## Connection manager
|
||||
|
||||
conn is a connection manager that allows you to store nodes to connect them fast and password free.
|
||||
Connpy is a connection manager that allows you to store nodes to connect them fast and password free.
|
||||
|
||||
### Features
|
||||
- You can generate profiles and reference them from nodes using @profilename
|
||||
@ -71,8 +71,8 @@ the automation module
|
||||
|
||||
### Standalone module
|
||||
```
|
||||
import conn
|
||||
router = conn.node("unique name","ip/hostname", user="username", password="pass")
|
||||
import connpy
|
||||
router = connpy.node("unique name","ip/hostname", user="username", password="pass")
|
||||
router.run(["term len 0","show run"])
|
||||
print(router.output)
|
||||
hasip = router.test("show ip int brief","1.1.1.1")
|
||||
@ -84,17 +84,17 @@ else:
|
||||
|
||||
### Using manager configuration
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
device = conf.getitem("server@office")
|
||||
server = conn.node("unique name", **device, config=conf)
|
||||
server = connpy.node("unique name", **device, config=conf)
|
||||
result = server.run(["cd /", "ls -la"])
|
||||
print(result)
|
||||
```
|
||||
### Running parallel tasks
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
#You can get the nodes from the config from a folder and fitlering in it
|
||||
nodes = conf.getitem("@office", ["router1", "router2", "router3"])
|
||||
#You can also get each node individually:
|
||||
@ -108,7 +108,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": "username", "password": "pass1"}
|
||||
nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"}
|
||||
nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"}
|
||||
#Finally you run some tasks on the nodes
|
||||
mynodes = conn.nodes(nodes, config = conf)
|
||||
mynodes = connpy.nodes(nodes, config = conf)
|
||||
result = mynodes.test(["show ip int br"], "1.1.1.2")
|
||||
for i in result:
|
||||
print("---" + i + "---")
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from conn import *
|
||||
from connpy import *
|
||||
|
||||
def main():
|
||||
conf = configfile()
|
@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
||||
<meta name="generator" content="pdoc 0.10.0" />
|
||||
<title>conn API documentation</title>
|
||||
<title>connpy API documentation</title>
|
||||
<meta name="description" content="Connection manager …" />
|
||||
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
||||
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
||||
@ -19,11 +19,11 @@
|
||||
<main>
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1 class="title">Package <code>conn</code></h1>
|
||||
<h1 class="title">Package <code>connpy</code></h1>
|
||||
</header>
|
||||
<section id="section-intro">
|
||||
<h2 id="connection-manager">Connection manager</h2>
|
||||
<p>conn is a connection manager that allows you to store nodes to connect them fast and password free.</p>
|
||||
<p>Connpy is a connection manager that allows you to store nodes to connect them fast and password free.</p>
|
||||
<h3 id="features">Features</h3>
|
||||
<pre><code>- You can generate profiles and reference them from nodes using @profilename
|
||||
so you dont need to edit multiple nodes when changing password or other
|
||||
@ -83,8 +83,8 @@ options:
|
||||
<h2 id="automation-module">Automation module</h2>
|
||||
<p>the automation module</p>
|
||||
<h3 id="standalone-module">Standalone module</h3>
|
||||
<pre><code>import conn
|
||||
router = conn.node("unique name","ip/hostname", user="username", password="pass")
|
||||
<pre><code>import connpy
|
||||
router = connpy.node("unique name","ip/hostname", user="username", password="pass")
|
||||
router.run(["term len 0","show run"])
|
||||
print(router.output)
|
||||
hasip = router.test("show ip int brief","1.1.1.1")
|
||||
@ -94,16 +94,16 @@ else:
|
||||
print("router don't has ip 1.1.1.1")
|
||||
</code></pre>
|
||||
<h3 id="using-manager-configuration">Using manager configuration</h3>
|
||||
<pre><code>import conn
|
||||
conf = conn.configfile()
|
||||
<pre><code>import connpy
|
||||
conf = connpy.configfile()
|
||||
device = conf.getitem("server@office")
|
||||
server = conn.node("unique name", **device, config=conf)
|
||||
server = connpy.node("unique name", **device, config=conf)
|
||||
result = server.run(["cd /", "ls -la"])
|
||||
print(result)
|
||||
</code></pre>
|
||||
<h3 id="running-parallel-tasks">Running parallel tasks</h3>
|
||||
<pre><code>import conn
|
||||
conf = conn.configfile()
|
||||
<pre><code>import connpy
|
||||
conf = connpy.configfile()
|
||||
#You can get the nodes from the config from a folder and fitlering in it
|
||||
nodes = conf.getitem("@office", ["router1", "router2", "router3"])
|
||||
#You can also get each node individually:
|
||||
@ -117,7 +117,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user&
|
||||
nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"}
|
||||
nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"}
|
||||
#Finally you run some tasks on the nodes
|
||||
mynodes = conn.nodes(nodes, config = conf)
|
||||
mynodes = connpy.nodes(nodes, config = conf)
|
||||
result = mynodes.test(["show ip int br"], "1.1.1.2")
|
||||
for i in result:
|
||||
print("---" + i + "---")
|
||||
@ -134,7 +134,7 @@ mynodes.router1.run(["term len 0". "show run"], folder = &qu
|
||||
'''
|
||||
## Connection manager
|
||||
|
||||
conn is a connection manager that allows you to store nodes to connect them fast and password free.
|
||||
Connpy is a connection manager that allows you to store nodes to connect them fast and password free.
|
||||
|
||||
### Features
|
||||
- You can generate profiles and reference them from nodes using @profilename
|
||||
@ -203,8 +203,8 @@ the automation module
|
||||
|
||||
### Standalone module
|
||||
```
|
||||
import conn
|
||||
router = conn.node("unique name","ip/hostname", user="username", password="pass")
|
||||
import connpy
|
||||
router = connpy.node("unique name","ip/hostname", user="username", password="pass")
|
||||
router.run(["term len 0","show run"])
|
||||
print(router.output)
|
||||
hasip = router.test("show ip int brief","1.1.1.1")
|
||||
@ -216,17 +216,17 @@ else:
|
||||
|
||||
### Using manager configuration
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
device = conf.getitem("server@office")
|
||||
server = conn.node("unique name", **device, config=conf)
|
||||
server = connpy.node("unique name", **device, config=conf)
|
||||
result = server.run(["cd /", "ls -la"])
|
||||
print(result)
|
||||
```
|
||||
### Running parallel tasks
|
||||
```
|
||||
import conn
|
||||
conf = conn.configfile()
|
||||
import connpy
|
||||
conf = connpy.configfile()
|
||||
#You can get the nodes from the config from a folder and fitlering in it
|
||||
nodes = conf.getitem("@office", ["router1", "router2", "router3"])
|
||||
#You can also get each node individually:
|
||||
@ -240,7 +240,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": &
|
||||
nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"}
|
||||
nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"}
|
||||
#Finally you run some tasks on the nodes
|
||||
mynodes = conn.nodes(nodes, config = conf)
|
||||
mynodes = connpy.nodes(nodes, config = conf)
|
||||
result = mynodes.test(["show ip int br"], "1.1.1.2")
|
||||
for i in result:
|
||||
print("---" + i + "---")
|
||||
@ -273,7 +273,7 @@ __pdoc__ = {
|
||||
<section>
|
||||
<h2 class="section-title" id="header-classes">Classes</h2>
|
||||
<dl>
|
||||
<dt id="conn.configfile"><code class="flex name class">
|
||||
<dt id="connpy.configfile"><code class="flex name class">
|
||||
<span>class <span class="ident">configfile</span></span>
|
||||
<span>(</span><span>conf=None, key=None)</span>
|
||||
</code></dt>
|
||||
@ -522,7 +522,7 @@ __pdoc__ = {
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="conn.configfile.getitem"><code class="name flex">
|
||||
<dt id="connpy.configfile.getitem"><code class="name flex">
|
||||
<span>def <span class="ident">getitem</span></span>(<span>self, unique, keys=None)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -595,7 +595,7 @@ __pdoc__ = {
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="conn.connapp"><code class="flex name class">
|
||||
<dt id="connpy.connapp"><code class="flex name class">
|
||||
<span>class <span class="ident">connapp</span></span>
|
||||
<span>(</span><span>config)</span>
|
||||
</code></dt>
|
||||
@ -1392,7 +1392,7 @@ complete -o nosort -F _conn conn
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="conn.connapp.encrypt"><code class="name flex">
|
||||
<dt id="connpy.connapp.encrypt"><code class="name flex">
|
||||
<span>def <span class="ident">encrypt</span></span>(<span>self, password, keyfile=None)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -1439,7 +1439,7 @@ complete -o nosort -F _conn conn
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="conn.node"><code class="flex name class">
|
||||
<dt id="connpy.node"><code class="flex name class">
|
||||
<span>class <span class="ident">node</span></span>
|
||||
<span>(</span><span>unique, host, options='', logs='', password='', port='', protocol='', user='', config='')</span>
|
||||
</code></dt>
|
||||
@ -1852,7 +1852,7 @@ complete -o nosort -F _conn conn
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="conn.node.interact"><code class="name flex">
|
||||
<dt id="connpy.node.interact"><code class="name flex">
|
||||
<span>def <span class="ident">interact</span></span>(<span>self, debug=False)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -1893,7 +1893,7 @@ complete -o nosort -F _conn conn
|
||||
exit(1)</code></pre>
|
||||
</details>
|
||||
</dd>
|
||||
<dt id="conn.node.run"><code class="name flex">
|
||||
<dt id="connpy.node.run"><code class="name flex">
|
||||
<span>def <span class="ident">run</span></span>(<span>self, commands, *, folder='', prompt='>$|#$|\\$$|>.$|#.$|\\$.$', stdout=False)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -1990,7 +1990,7 @@ complete -o nosort -F _conn conn
|
||||
return connect</code></pre>
|
||||
</details>
|
||||
</dd>
|
||||
<dt id="conn.node.test"><code class="name flex">
|
||||
<dt id="connpy.node.test"><code class="name flex">
|
||||
<span>def <span class="ident">test</span></span>(<span>self, commands, expected, *, prompt='>$|#$|\\$$|>.$|#.$|\\$.$')</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -2085,7 +2085,7 @@ complete -o nosort -F _conn conn
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="conn.nodes"><code class="flex name class">
|
||||
<dt id="connpy.nodes"><code class="flex name class">
|
||||
<span>class <span class="ident">nodes</span></span>
|
||||
<span>(</span><span>nodes: dict, config='')</span>
|
||||
</code></dt>
|
||||
@ -2285,7 +2285,7 @@ complete -o nosort -F _conn conn
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="conn.nodes.run"><code class="name flex">
|
||||
<dt id="connpy.nodes.run"><code class="name flex">
|
||||
<span>def <span class="ident">run</span></span>(<span>self, commands, *, folder=None, prompt=None, stdout=None, parallel=10)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -2378,7 +2378,7 @@ parallel (int): Number of nodes to run the commands simultaneously.
|
||||
return output</code></pre>
|
||||
</details>
|
||||
</dd>
|
||||
<dt id="conn.nodes.test"><code class="name flex">
|
||||
<dt id="connpy.nodes.test"><code class="name flex">
|
||||
<span>def <span class="ident">test</span></span>(<span>self, commands, expected, *, prompt=None, parallel=10)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
@ -2485,30 +2485,30 @@ expected (str) : Expected text to appear after running all the
|
||||
<li><h3><a href="#header-classes">Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<h4><code><a title="conn.configfile" href="#conn.configfile">configfile</a></code></h4>
|
||||
<h4><code><a title="connpy.configfile" href="#connpy.configfile">configfile</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="conn.configfile.getitem" href="#conn.configfile.getitem">getitem</a></code></li>
|
||||
<li><code><a title="connpy.configfile.getitem" href="#connpy.configfile.getitem">getitem</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="conn.connapp" href="#conn.connapp">connapp</a></code></h4>
|
||||
<h4><code><a title="connpy.connapp" href="#connpy.connapp">connapp</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="conn.connapp.encrypt" href="#conn.connapp.encrypt">encrypt</a></code></li>
|
||||
<li><code><a title="connpy.connapp.encrypt" href="#connpy.connapp.encrypt">encrypt</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="conn.node" href="#conn.node">node</a></code></h4>
|
||||
<h4><code><a title="connpy.node" href="#connpy.node">node</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="conn.node.interact" href="#conn.node.interact">interact</a></code></li>
|
||||
<li><code><a title="conn.node.run" href="#conn.node.run">run</a></code></li>
|
||||
<li><code><a title="conn.node.test" href="#conn.node.test">test</a></code></li>
|
||||
<li><code><a title="connpy.node.interact" href="#connpy.node.interact">interact</a></code></li>
|
||||
<li><code><a title="connpy.node.run" href="#connpy.node.run">run</a></code></li>
|
||||
<li><code><a title="connpy.node.test" href="#connpy.node.test">test</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h4><code><a title="conn.nodes" href="#conn.nodes">nodes</a></code></h4>
|
||||
<h4><code><a title="connpy.nodes" href="#connpy.nodes">nodes</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="conn.nodes.run" href="#conn.nodes.run">run</a></code></li>
|
||||
<li><code><a title="conn.nodes.test" href="#conn.nodes.test">test</a></code></li>
|
||||
<li><code><a title="connpy.nodes.run" href="#connpy.nodes.run">run</a></code></li>
|
||||
<li><code><a title="connpy.nodes.test" href="#connpy.nodes.test">test</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=./conn/" />
|
||||
<meta http-equiv="refresh" content="0; url=./connpy/" />
|
||||
</head>
|
||||
|
||||
</html>
|
||||
|
@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
name = conn
|
||||
version = attr: conn.__version__
|
||||
description = Conn is a SSH/Telnet connection manager and automation module
|
||||
name = connpy
|
||||
version = attr: connpy.__version__
|
||||
description = Connpy is a SSH/Telnet connection manager and automation module
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
keywords = networking, automation, ssh, telnet, connection manager
|
||||
@ -31,4 +31,5 @@ install_requires =
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
conn = conn.__main__:main
|
||||
conn = connpy.__main__:main
|
||||
connpy = connpy.__main__:main
|
||||
|
Loading…
Reference in New Issue
Block a user