From b5df98449880df70a297132d539c40c3670b01a7 Mon Sep 17 00:00:00 2001 From: fluzzi Date: Sat, 2 Apr 2022 23:37:39 -0300 Subject: [PATCH] failed docs --- docs/Makefile | 20 ------ docs/conf.py | 54 --------------- docs/doc.md | 180 ------------------------------------------------- docs/index.rst | 22 ------ docs/make.bat | 35 ---------- 5 files changed, 311 deletions(-) delete mode 100644 docs/Makefile delete mode 100644 docs/conf.py delete mode 100644 docs/doc.md delete mode 100644 docs/index.rst delete mode 100644 docs/make.bat diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d4bb2cb..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 957c47f..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,54 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'conn' -copyright = '2022, Federico Luzzi' -author = 'Federico Luzzi' - -# The full version, including alpha/beta/rc tags -release = '2.0.10' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['myst_parser'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] diff --git a/docs/doc.md b/docs/doc.md deleted file mode 100644 index dacaca4..0000000 --- a/docs/doc.md +++ /dev/null @@ -1,180 +0,0 @@ -Module conn -=========== - -Classes -------- - -`configfile(conf=None, *, key=None)` -: - - ### Methods - - `createconfig(self, conf)` - : - - `createkey(self, keyfile)` - : - - `getitem(self, unique, keys=None)` - : - - `loadconfig(self, conf)` - : - - `saveconfig(self, conf)` - : - -`node(unique, host, options='', logs='', password='', port='', protocol='', user='', config='')` -: This class generates a node object. Containts all the information and methods to connect and interact with a device using ssh or telnet. - - Attributes: - - - output (str) -- Output of the commands you ran with run or test - -- method. - - result(bool) -- True if expected value is found after running - -- the commands using test method. - - - - Parameters: - - - unique (str) -- Unique name to assign to the node. - - host (str) -- IP address or hostname of the node. - - Optional Parameters: - - - options (str) -- Additional options to pass the ssh/telnet for - -- connection. - - logs (str) -- Path/file for storing the logs. You can use - -- ${unique},${host}, ${port}, ${user}, ${protocol} - -- as variables. - - password (str) -- Encrypted or plaintext password. - - port (str) -- Port to connect to node, default 22 for ssh and 23 - -- for telnet. - - protocol (str) -- Select ssh or telnet. Default is ssh. - - user (str) -- Username to of the node. - - config (obj) -- Pass the object created with class configfile with - -- key for decryption and extra configuration if you - -- are using connection manager. - - ### Methods - - `interact(self, debug=False)` - : Allow user to interact with the node directly, mostly used by connection manager. - - Optional Parameters: - - - debug (bool) -- If True, display all the connecting information - -- before interact. Default False. - - `run(self, commands, *, folder='', prompt='>$|#$|\\$$|>.$|#.$|\\$.$', stdout=False)` - : Run a command or list of commands on the node and return the output. - - Parameters: - - - commands (str/list) -- Commands to run on the node. Should be - -- str or a list of str. - - Optional Named Parameters: - - - folder (str) -- Path where output log should be stored, leave - -- empty to disable logging. - - prompt (str) -- Prompt to be expected after a command is finished - -- running. Usually linux uses ">" or EOF while - -- routers use ">" or "#". The default value should - -- work for most nodes. Change it if your connection - -- need some special symbol. - - stdout (bool) -- Set True to send the command output to stdout. - -- default False. - - Returns: - - str -> Output of the commands you ran on the node. - - `test(self, commands, expected, *, prompt='>$|#$|\\$$|>.$|#.$|\\$.$')` - : Run a command or list of commands on the node, then check if expected value appears on the output after the last command. - - Parameters: - - - commands (str/list) -- Commands to run on the node. Should be - -- str or list of str. - - expected (str) -- Expected text to appear after running - -- all the commands on the node. - - Optional Named Parameters: - - - prompt (str) -- Prompt to be expected after a command is finished - -- running. Usually linux uses ">" or EOF while - -- routers use ">" or "#". The default value should - -- work for most nodes. Change it if your connection - -- need some special symbol. - - Returns: - - bool -> true if expected value is found after running the commands - false if prompt is found before. - -`nodes(nodes: dict, config='')` -: This class generates a nodes object. Contains a list of node class objects and methods to run multiple tasks on nodes simultaneously. - - ### Attributes: - - - nodelist (list): List of node class objects passed to the init - function. - - - output (dict): Dictionary formed by nodes unique as keys, output of the commands you ran on the node as - value. Created after running methods run or test. - - - result (dict): Dictionary formed by nodes unique as keys, value - is True if expected value is found after running - the commands, False if prompt is found before. - Created after running method test. - - - (obj): For each item in nodelist, there is an attribute - generated with the node unique. - - - ### Parameters: - - - nodes (dict): Dictionary formed by node information: - Keys: Unique name for each node. - Mandatory Subkeys: host(str). - Optional Subkeys: options(str), logs(str), password(str), - port(str), protocol(str), user(str). - For reference on subkeys check node class. - - Optional Parameters: - - - config (obj): Pass the object created with class configfile with key - for decryption and extra configuration if you are using - connection manager. - - ### Methods - - `run(self, commands, *, folder=None, prompt=None, stdout=None, parallel=10)` - : Run a command or list of commands on all the nodes in nodelist. - - Parameters: - commands (str/list): Commands to run on the node. Should be a str or a list of str. - - Optional Named Parameters: - folder (str): Path where output log should be stored, leave empty to disable logging. - prompt (str): Prompt to be expected after a command is finished running. Usually linux uses ">" or EOF while routers use ">" or "#". The default value should work for most nodes. Change it if your connection need some special symbol. - stdout (bool): Set True to send the command output to stdout. default False. - parallel (int): Number of nodes to run the commands simultaneously. Default is 10, if there are more nodes that this value, nodes are groups in groups with max this number of members. - - Returns: - dict: Dictionary formed by nodes unique as keys, Output of the commands you ran on the node as value. - - `test(self, commands, expected, *, prompt=None, parallel=10)` - : Run a command or list of commands on all the nodes in nodelist, then check if expected value appears on the output after the last command. - - Parameters: - commands (str/list): Commands to run on the node. Should be a str or a list of str. - commands (str): Expected text to appear after running all the commands on the node. - - Optional Named Parameters: - prompt (str): Prompt to be expected after a command is finished running. Usually linux uses ">" or EOF while routers use ">" or "#". The default value should work for most nodes. Change it if your connection need some special symbol. - - Returns: - dict: Dictionary formed by nodes unique as keys, value is True if expected value is found after running the commands, False if prompt is found before. diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 2af75dd..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. conn documentation master file, created by - sphinx-quickstart on Sat Apr 2 23:19:12 2022. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to conn's documentation! -================================ - -.. toctree:: - - doc.md - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 32bb245..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd