Hello community,

here is the log from the commit of package python-junos-eznc for 
openSUSE:Factory checked in at 2020-11-02 09:41:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-junos-eznc (Old)
 and      /work/SRC/openSUSE:Factory/.python-junos-eznc.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-junos-eznc"

Mon Nov  2 09:41:31 2020 rev:9 rq:845024 version:2.5.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-junos-eznc/python-junos-eznc.changes      
2020-09-21 17:33:21.792454588 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-junos-eznc.new.3463/python-junos-eznc.changes
    2020-11-02 09:41:47.381690315 +0100
@@ -1,0 +2,18 @@
+Thu Oct 29 19:40:57 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 2.5.4
+  Features Added
+  * cRPD model check to be added for on-box junos.
+  Bugs Fixed
+  * support use-fast-diff in diff/pdff function.
+  * Zeroize handling modified for scenario where only warning is
+    returned in the rpc-reply.
+  * ntc_template and textfsm module's installation made optional
+    and to be done explicitly if one want to use PyEZ table/view
+    for other vendors cli o/p parsing.
+  * Checksum algorithm argument to be passed during remote
+    checksum in software installation.
+  * docstring initialized with empty string as it becomes empty
+    if optimization flag is added.
+
+-------------------------------------------------------------------

Old:
----
  python-junos-eznc-2.5.3.tar.gz

New:
----
  python-junos-eznc-2.5.4.tar.gz

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

Other differences:
------------------
++++++ python-junos-eznc.spec ++++++
--- /var/tmp/diff_new_pack.JU8FzK/_old  2020-11-02 09:41:47.829690744 +0100
+++ /var/tmp/diff_new_pack.JU8FzK/_new  2020-11-02 09:41:47.833690749 +0100
@@ -20,7 +20,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-junos-eznc
-Version:        2.5.3
+Version:        2.5.4
 Release:        0
 Summary:        Junos 'EZ' automation for non-programmers
 License:        Apache-2.0

++++++ python-junos-eznc-2.5.3.tar.gz -> python-junos-eznc-2.5.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/.travis.yml 
new/py-junos-eznc-2.5.4/.travis.yml
--- old/py-junos-eznc-2.5.3/.travis.yml 2020-08-25 11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/.travis.yml 2020-10-28 17:16:20.000000000 +0100
@@ -16,6 +16,8 @@
           python: 3.7
           before_install:
             - choco install python3 --version=3.7.4
+            - pip install ntc_templates==1.4.1
+            - pip install textfsm==0.4.1
           env:
             - PATH=/c/Python37:/c/Python37/Scripts:$PATH
             - TRAVIS_PYTHON_VERSION=3.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/development.txt 
new/py-junos-eznc-2.5.4/development.txt
--- old/py-junos-eznc-2.5.3/development.txt     2020-08-25 11:35:29.000000000 
+0200
+++ new/py-junos-eznc-2.5.4/development.txt     2020-10-28 17:16:20.000000000 
+0100
@@ -6,3 +6,4 @@
 pep8        # https://github.com/jcrocholl/pep8
 pyflakes        # https://launchpad.net/pyflakes
 coveralls       # https://coveralls.io/
+ntc_templates # user needs to explicitly install this
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/entrypoint.sh 
new/py-junos-eznc-2.5.4/entrypoint.sh
--- old/py-junos-eznc-2.5.3/entrypoint.sh       2020-08-25 11:35:29.000000000 
+0200
+++ new/py-junos-eznc-2.5.4/entrypoint.sh       2020-10-28 17:16:20.000000000 
+0100
@@ -19,7 +19,7 @@
 
 function run_scripts {
     echo "Executing defined script"
-    python3 "$1"
+    python3 $1 ${@:2}
 }
 
 ## Manually defined variables will take precedence
@@ -34,7 +34,7 @@
 else REQ=''
 fi
 
-if [ "$1" ]; then SCRIPT=$1
+if [ "$#" ]; then SCRIPT=$@
 else SCRIPT=''
 fi
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/_version.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/_version.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/_version.py  2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/_version.py  2020-10-28 
17:16:20.000000000 +0100
@@ -22,9 +22,9 @@
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (HEAD -> master, tag: 2.5.3)"
-    git_full = "db3886c21d51f59ac550c1b87a9d44bdc98ee963"
-    git_date = "2020-08-25 15:05:29 +0530"
+    git_refnames = " (HEAD -> master, tag: 2.5.4)"
+    git_full = "5095bf7dcbb92edae9bb640de2d5c21a870f3d1f"
+    git_date = "2020-10-28 21:46:20 +0530"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/lib/jnpr/junos/cfg/phyport/__init__.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/cfg/phyport/__init__.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/cfg/phyport/__init__.py      
2020-08-25 11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/cfg/phyport/__init__.py      
2020-10-28 17:16:20.000000000 +0100
@@ -7,8 +7,9 @@
 
 class PhyPort(object):
     def __new__(cls, dev, name=None):
-        supercls = {"CLASSIC": PhyPortClassic, "SWITCH": PhyPortSwitch,}.get(
-            dev.facts["ifd_style"]
-        )
+        supercls = {
+            "CLASSIC": PhyPortClassic,
+            "SWITCH": PhyPortSwitch,
+        }.get(dev.facts["ifd_style"])
         newcls = type(cls.__name__, (supercls,), {})
         return newcls(dev, name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/cfg/resource.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/cfg/resource.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/cfg/resource.py      2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/cfg/resource.py      2020-10-28 
17:16:20.000000000 +0100
@@ -535,11 +535,11 @@
 
     def __repr__(self):
         """
-          stringify for debug/printing
+        stringify for debug/printing
 
-          this will show the resource manager (class) name,
-          the resource (Junos) name, and the contents
-          of the :has: dict and the contents of the :should: dict
+        this will show the resource manager (class) name,
+        the resource (Junos) name, and the contents
+        of the :has: dict and the contents of the :should: dict
         """
         mgr_name = self.__class__.__name__
         return (
@@ -600,9 +600,9 @@
 
     def _xml_build_change(self):
         """
-          iterate through the :should: properties creating the
-          necessary configuration change structure.  if there
-          are no changes, then return :None:
+        iterate through the :should: properties creating the
+        necessary configuration change structure.  if there
+        are no changes, then return :None:
         """
         edit_xml = self._xml_edit_at_res()
 
@@ -638,8 +638,8 @@
 
     def _r_config_write_xml(self, xml):
         """
-          write the xml change to the Junos device,
-          trapping on exceptions.
+        write the xml change to the Junos device,
+        trapping on exceptions.
         """
         top_xml = xml.getroottree().getroot()
 
@@ -757,8 +757,8 @@
 
     def _r_when_new(self):
         """
-          called by :read(): when the resource is new; i.e.
-          there is no existing Junos configuration
+        called by :read(): when the resource is new; i.e.
+        there is no existing Junos configuration
         """
         pass
 
@@ -786,7 +786,7 @@
     @classmethod
     def _r_has_xml_status(klass, as_xml, as_py):
         """
-          set the 'exists' and 'active' :has: values
+        set the 'exists' and 'active' :has: values
         """
         as_py[P_JUNOS_ACTIVE] = False if as_xml.attrib.get("inactive") else 
True
         as_py[P_JUNOS_EXISTS] = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/console.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/console.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/console.py   2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/console.py   2020-10-28 
17:16:20.000000000 +0100
@@ -1,7 +1,3 @@
-"""
-This file defines the 'netconifyCmdo' class.
-Used by the 'netconify' shell utility.
-"""
 import traceback
 import sys
 import logging
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/device.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/device.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/device.py    2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/device.py    2020-10-28 
17:16:20.000000000 +0100
@@ -93,6 +93,27 @@
         or platform.release().startswith("JNPR")
         or os.path.isfile("/usr/share/cevo/cevo_version")
     )
+
+    # for juniper specific containers likes crpd, cmgd, cbng
+    # and similar entities, we will need to check the product.conf
+    # file for on-box implementation
+
+    if ON_JUNOS is False:
+        if os.path.isfile("/etc/product.conf") is True:
+            model_dict = {}
+            with open("/etc/product.conf") as f:
+                for line in f:
+                    if "=" in line:
+                        (key, val) = line.strip().split("=")
+                        model_dict[key] = val
+
+            if "model" in model_dict and model_dict["model"] in [
+                "crpd",
+                "cbng",
+                "cmgd",
+            ]:
+                ON_JUNOS = True
+
     auto_probe = 0  # default is no auto-probe
 
     # ------------------------------------------------------------------------
@@ -422,15 +443,15 @@
         raise RuntimeError("re_name is read-only!")
 
     def _sshconf_lkup(self):
-        """ Controls the ssh connection:
-            If using ssh_private_key_file on MacOS Mojave or greater
-            (specifically > OpenSSH_7.4p1) ensure that the keys are generated
-            in PEM format or convert existing 'new' keys to the PEM format:
-            Check format: `head -n1 ~/.ssh/some_key`
-            Correct RSA fomat: -----BEGIN RSA PRIVATE KEY-----
-            Incorrect OPENSSH format: -----BEGIN OPENSSH PRIVATE KEY-----
-            Convert an OPENSSH key to an RSA key: `ssh-keygen -p -m PEM -f 
~/.ssh/some_key`
-            """
+        """Controls the ssh connection:
+        If using ssh_private_key_file on MacOS Mojave or greater
+        (specifically > OpenSSH_7.4p1) ensure that the keys are generated
+        in PEM format or convert existing 'new' keys to the PEM format:
+        Check format: `head -n1 ~/.ssh/some_key`
+        Correct RSA fomat: -----BEGIN RSA PRIVATE KEY-----
+        Incorrect OPENSSH format: -----BEGIN OPENSSH PRIVATE KEY-----
+        Convert an OPENSSH key to an RSA key: `ssh-keygen -p -m PEM -f 
~/.ssh/some_key`
+        """
         if self.__class__.__name__ == "Device" and self._sock_fd is not None:
             return None
         if self._ssh_config:
@@ -1116,7 +1137,7 @@
 
         :param str sock_fd:
             **REQUIRED** file descriptor of an existing socket instead of 
providing a host.
-            Used for outbound ssh. 
+            Used for outbound ssh.
 
         :param str user:
             *OPTIONAL* login user-name, uses $USER if not provided
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/exception.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/exception.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/exception.py 2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/exception.py 2020-10-28 
17:16:20.000000000 +0100
@@ -21,12 +21,12 @@
 
     def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, 
re=None):
         """
-          :cmd: is the rpc command
-          :rsp: is the rpc response (after <rpc-reply>)
-          :errs: is a list of dictionaries of extracted <rpc-error> elements.
-          :dev: is the device rpc was executed on
-          :timeout: is the timeout value of the device
-          :re: is the RE or member exception occured on
+        :cmd: is the rpc command
+        :rsp: is the rpc response (after <rpc-reply>)
+        :errs: is a list of dictionaries of extracted <rpc-error> elements.
+        :dev: is the device rpc was executed on
+        :timeout: is the timeout value of the device
+        :re: is the RE or member exception occured on
         """
         self.cmd = cmd
         self.rsp = rsp
@@ -71,7 +71,7 @@
 
     def __repr__(self):
         """
-          pprints the response XML attribute
+        pprints the response XML attribute
         """
         if self.rpc_error is not None:
             return "{}(severity: {}, bad_element: {}, message: {})".format(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/factcache.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/factcache.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/factcache.py 2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/factcache.py 2020-10-28 
17:16:20.000000000 +0100
@@ -294,6 +294,10 @@
                 self._warnings_on_failure = False
                 self._should_warn = False
 
+    # In case optimization flag is enabled, it strips of docstring and __doc__ 
becomes None
+    if __doc__ is None:
+        __doc__ = ""
+
     # Precede the class's documentation with the documentation on the specific
     # facts from  the jnpr.junos.facts package.
     __doc__ = facts_doc + "Implementation details on the _FactCache class:" + 
__doc__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/lib/jnpr/junos/factory/cfgtable.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/factory/cfgtable.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/factory/cfgtable.py  2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/factory/cfgtable.py  2020-10-28 
17:16:20.000000000 +0100
@@ -181,9 +181,12 @@
         """
 
         def _get_field_type(ftype):
-            ft = {"str": str, "int": int, "float": float, "bool": bool,}.get(
-                ftype, None
-            )
+            ft = {
+                "str": str,
+                "int": int,
+                "float": float,
+                "bool": bool,
+            }.get(ftype, None)
 
             if ft is None:
                 raise TypeError("Unsupported type %s\n" % (ftype))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/lib/jnpr/junos/factory/cmdtable.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/factory/cmdtable.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/factory/cmdtable.py  2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/factory/cmdtable.py  2020-10-28 
17:16:20.000000000 +0100
@@ -16,7 +16,14 @@
 from jnpr.junos.factory.to_json import TableJSONEncoder
 
 from jinja2 import Template
-from ntc_templates import parse as ntc_parse
+
+HAS_NTC_TEMPLATE = False
+try:
+    from ntc_templates import parse as ntc_parse
+
+    HAS_NTC_TEMPLATE = True
+except:
+    pass
 
 import logging
 
@@ -153,9 +160,14 @@
                 self.data = self.xml.text
 
         if self.USE_TEXTFSM:
-            self.output = self._parse_textfsm(
-                platform=self.PLATFORM, command=self.GET_CMD, raw=self.data
-            )
+            if HAS_NTC_TEMPLATE:
+                self.output = self._parse_textfsm(
+                    platform=self.PLATFORM, command=self.GET_CMD, raw=self.data
+                )
+            else:
+                raise ImportError(
+                    "ntc_template is missing. Need to be installed explicitly."
+                )
         else:
             # state machine
             sm = StateMachine(self)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/facts/__init__.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/facts/__init__.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/facts/__init__.py    2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/facts/__init__.py    2020-10-28 
17:16:20.000000000 +0100
@@ -86,6 +86,10 @@
 # Import all of the fact modules and build the callbacks and doc strings
 (_callbacks, _doc_strings) = _build_fact_callbacks_and_doc_strings()
 
+# In case optimization flag is enabled, it strips of docstring and __doc__ 
becomes None
+if __doc__ is None:
+    __doc__ = ""
+
 # Append the doc string (__doc__) with the documentation for each fact.
 for key in sorted(_doc_strings, key=lambda s: s.lower()):
     __doc__ += ":%s:\n  %s\n" % (key, _doc_strings[key])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/lib/jnpr/junos/facts/current_re.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/facts/current_re.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/facts/current_re.py  2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/facts/current_re.py  2020-10-28 
17:16:20.000000000 +0100
@@ -37,7 +37,9 @@
                 current_re.append(re_name[0].text)
         else:
             rsp = device.rpc.get_interface_information(
-                normalize=True, routing_instance="__juniper_private1__", 
terse=True,
+                normalize=True,
+                routing_instance="__juniper_private1__",
+                terse=True,
             )
 
             # Get the local IPv4 addresses from the response.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/jxml.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/jxml.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/jxml.py      2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/jxml.py      2020-10-28 
17:16:20.000000000 +0100
@@ -193,8 +193,8 @@
 
 def rpc_error(rpc_xml):
     """
-      extract the various bits from an <rpc-error> element
-      into a dictionary
+    extract the various bits from an <rpc-error> element
+    into a dictionary
     """
     remove_namespaces(rpc_xml)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/rpcmeta.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/rpcmeta.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/rpcmeta.py   2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/rpcmeta.py   2020-10-28 
17:16:20.000000000 +0100
@@ -13,9 +13,9 @@
 
     def __init__(self, junos):
         """
-          ~PRIVATE CLASS~
-          creates an RPC meta-executor object bound to the provided
-          ez-netconf :junos: object
+        ~PRIVATE CLASS~
+        creates an RPC meta-executor object bound to the provided
+        ez-netconf :junos: object
         """
         self._junos = junos
 
@@ -303,12 +303,12 @@
 
     def __getattr__(self, rpc_cmd_name):
         """
-          metaprograms a function to execute the :rpc_cmd_name:
+        metaprograms a function to execute the :rpc_cmd_name:
 
-          the caller will be passing (*vargs, **kvargs) on
-          execution of the meta function; these are the specific
-          rpc command arguments(**kvargs) and options bound
-          as XML attributes (*vargs)
+        the caller will be passing (*vargs, **kvargs) on
+        execution of the meta function; these are the specific
+        rpc command arguments(**kvargs) and options bound
+        as XML attributes (*vargs)
         """
 
         rpc_cmd = re.sub("_", "-", rpc_cmd_name)
@@ -378,10 +378,10 @@
 
     def __call__(self, rpc_cmd, **kvargs):
         """
-          callable will execute the provided :rpc_cmd: against the
-          attached :junos: object and return the RPC response per
-          :junos:execute()
+        callable will execute the provided :rpc_cmd: against the
+        attached :junos: object and return the RPC response per
+        :junos:execute()
 
-          kvargs is simply passed 'as-is' to :junos:execute()
+        kvargs is simply passed 'as-is' to :junos:execute()
         """
         return self._junos.execute(rpc_cmd, **kvargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/lib/jnpr/junos/transport/tty_netconf.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/transport/tty_netconf.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/transport/tty_netconf.py     
2020-08-25 11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/transport/tty_netconf.py     
2020-10-28 17:16:20.000000000 +0100
@@ -64,7 +64,7 @@
                 break
         else:
             # exceeded the while loop timeout
-            raise RuntimeError("Netconify Error: netconf not responding")
+            raise RuntimeError("Error: netconf not responding")
 
         self.hello = self._receive()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/utils/config.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/utils/config.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/utils/config.py      2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/utils/config.py      2020-10-28 
17:16:20.000000000 +0100
@@ -219,12 +219,14 @@
     # show | compare rollback <number|0*>
     # -------------------------------------------------------------------------
 
-    def diff(self, rb_id=0, ignore_warning=False):
+    def diff(self, rb_id=0, ignore_warning=False, use_fast_diff=False):
         """
         Retrieve a diff (patch-format) report of the candidate config against
         either the current active config, or a different rollback.
 
         :param int rb_id: rollback id [0..49]
+        :param bool ignore_warning: Ignore any rpc-error with severity warning
+        :param bool use_fast_diff: equivalent to "show | compare use-fast-diff"
 
         :returns:
             * ``None`` if there is no difference
@@ -234,9 +236,14 @@
         if rb_id < 0 or rb_id > 49:
             raise ValueError("Invalid rollback #" + str(rb_id))
 
+        rpc_params = dict(compare="rollback", rollback=str(rb_id), 
format="text")
+        if use_fast_diff:
+            if rb_id > 0:
+                raise ValueError("use_fast_diff can only be used with rb_id 0")
+            rpc_params["use-fast-diff"] = "yes"
         try:
             rsp = self.rpc.get_configuration(
-                dict(compare="rollback", rollback=str(rb_id), format="text"),
+                rpc_params,
                 ignore_warning=ignore_warning,
             )
         except RpcTimeoutError:
@@ -256,16 +263,18 @@
         diff_txt = rsp.find("configuration-output").text
         return None if diff_txt == "\n" else diff_txt
 
-    def pdiff(self, rb_id=0):
+    def pdiff(self, rb_id=0, ignore_warning=False, use_fast_diff=False):
         """
         Helper method that calls ``print`` on the diff (patch-format) between
         the current candidate and the provided rollback.
 
         :param int rb_id: the rollback id value [0-49]
+        :param bool ignore_warning: Ignore any rpc-error with severity warning
+        :param bool use_fast_diff: equivalent to "show | compare use-fast-diff"
 
         :returns: ``None``
         """
-        print(self.diff(rb_id))
+        print(self.diff(rb_id, ignore_warning, use_fast_diff))
 
     # -------------------------------------------------------------------------
     # helper on loading configs
@@ -301,8 +310,10 @@
             .. note:: The format can specifically set using **format**.
 
         :param str format:
-          Determines the format of the contents. Refer to options
-          from the **path** description.
+            Determines the format of the contents.
+            Supported options - text, set, xml, json
+
+            If not provided, internally application will try to find out the 
format
 
         :param bool overwrite:
           Determines if the contents completely replace the existing
@@ -346,7 +357,7 @@
         :param dict template_vars:
           Used in conjunction with the other template options.  This parameter
           contains a dictionary of variables to render into the template.
-          
+
         :param ignore_warning: A boolean, string or list of string.
           If the value is True, it will ignore all warnings regardless of the
           warning message. If the value is a string, it will ignore
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/lib/jnpr/junos/utils/sw.py 
new/py-junos-eznc-2.5.4/lib/jnpr/junos/utils/sw.py
--- old/py-junos-eznc-2.5.3/lib/jnpr/junos/utils/sw.py  2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/lib/jnpr/junos/utils/sw.py  2020-10-28 
17:16:20.000000000 +0100
@@ -23,6 +23,8 @@
 from jnpr.junos.utils.ftp import FTP
 from jnpr.junos.utils.start_shell import StartShell
 from jnpr.junos.exception import SwRollbackError, RpcTimeoutError, RpcError
+from ncclient.xml_ import NCElement
+from jnpr.junos import jxml as JXML
 
 """
 Software Installation Utilities
@@ -659,7 +661,9 @@
             _progress(
                 "after copy, computing checksum on remote package: %s" % 
remote_package
             )
-            remote_checksum = self.remote_checksum(remote_package)
+            remote_checksum = self.remote_checksum(
+                remote_package, timeout=checksum_timeout, 
algorithm=checksum_algorithm
+            )
 
         if remote_checksum != checksum:
             _progress("checksum check failed.")
@@ -886,7 +890,7 @@
                 return False
         except RpcError:
             _progress(
-                "request-package-check-pending-install rpc is not "
+                "request-package-checks-pending-install rpc is not "
                 "supported on given device"
             )
         except Exception as ex:
@@ -1245,18 +1249,53 @@
             if media is True:
                 cmd = E("media")
 
+        # initialize an empty output message
+        output_msg = ""
+
         try:
             # For zeroize we don't get a response similar to reboot, shutdown.
-            # In ansible it was passed even if rpc-reply was not coming.
-            # Code is added here to reply the message else pass an empty 
string.
-            rsp = self.rpc(cmd, ignore_warning=True, normalize=True)
-            output_msg = "\n".join(
-                [i.text for i in rsp.xpath("//message") if i.text is not None]
-            )
-            return output_msg
+            # The response may come as a warning message only.
+            # Code is added here to extract the warning message and append it.
+            # Don't pass ignore warning true and handle the warning here.
+            rsp = self.rpc(cmd, normalize=True)
+        except RpcError as ex:
+            if hasattr(ex, "xml"):
+                if hasattr(ex, "errs"):
+                    errors = ex.errs
+                else:
+                    errors = [ex]
+                for err in errors:
+                    if err.get("severity", "") != "warning":
+                        # Not a warning (probably an error).
+                        raise ex
+                    output_msg += err.get("message", "") + "\n"
+                rsp = ex.xml.getroottree().getroot()
+                # 1) A normal response has been run through the XSLT
+                #    transformation, but ex.xml has not. Do that now.
+                encode = None if sys.version < "3" else "unicode"
+                rsp = NCElement(
+                    etree.tostring(rsp, encoding=encode), self._dev.transform()
+                )._NCElement__doc
+                # 2) Now remove all of the <rpc-error> elements from
+                #    the response. We've already confirmed they are all 
warnings
+                rsp = 
etree.fromstring(str(JXML.strip_rpc_error_transform(rsp)))
+            else:
+                # ignore_warning was false, or an RPCError which doesn't have
+                #  an XML attribute. Raise it up for the caller to deal with.
+                raise ex
         except Exception as err:
             raise err
 
+        # safety check added in case the rpc-reply for zeroize doesn't have 
message
+        # This scenario is not expected.
+        if isinstance(rsp, bool):
+            return "zeroize initiated with no message"
+
+        output_msg += "\n".join(
+            [i.text for i in rsp.xpath("//message") if i.text is not None]
+        )
+        return output_msg
+
     # -------------------------------------------------------------------------
     # rollback - clears the install request
     # -------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/requirements.txt 
new/py-junos-eznc-2.5.4/requirements.txt
--- old/py-junos-eznc-2.5.3/requirements.txt    2020-08-25 11:35:29.000000000 
+0200
+++ new/py-junos-eznc-2.5.4/requirements.txt    2020-10-28 17:16:20.000000000 
+0100
@@ -10,4 +10,3 @@
 yamlordereddictloader
 pyparsing
 transitions
-ntc_templates
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/setup.py 
new/py-junos-eznc-2.5.4/setup.py
--- old/py-junos-eznc-2.5.3/setup.py    2020-08-25 11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/setup.py    2020-10-28 17:16:20.000000000 +0100
@@ -1,19 +1,10 @@
 from setuptools import setup, find_packages
-import sys
 import versioneer
 
 # parse requirements
 req_lines = [line.strip() for line in open("requirements.txt").readlines()]
 install_reqs = list(filter(None, req_lines))
 
-# refer: https://github.com/Juniper/py-junos-eznc/issues/1015
-# should be removed when textfsm releases >=1.1.1
-if sys.platform == "win32":
-    if "ntc_templates" in install_reqs:
-        install_reqs.remove("ntc_templates")
-        install_reqs.append("ntc_templates==1.4.1")
-    install_reqs.append("textfsm==0.4.1")
-
 setup(
     name="junos-eznc",
     namespace_packages=["jnpr"],
@@ -51,6 +42,7 @@
         "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
         "Topic :: Software Development :: Libraries",
         "Topic :: Software Development :: Libraries :: Application Frameworks",
         "Topic :: Software Development :: Libraries :: Python Modules",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/py-junos-eznc-2.5.3/tests/unit/utils/rpc-reply/request-zeroize.xml 
new/py-junos-eznc-2.5.4/tests/unit/utils/rpc-reply/request-zeroize.xml
--- old/py-junos-eznc-2.5.3/tests/unit/utils/rpc-reply/request-zeroize.xml      
1970-01-01 01:00:00.000000000 +0100
+++ new/py-junos-eznc-2.5.4/tests/unit/utils/rpc-reply/request-zeroize.xml      
2020-10-28 17:16:20.000000000 +0100
@@ -0,0 +1,30 @@
+<rpc-reply>
+<rpc-error>
+<error-severity>warning</error-severity>
+<error-message>
+ipsec-key-management subsystem not running - not needed by configuration.
+</error-message>
+</rpc-error>
+<warning xmlns="http://xml.juniper.net/xnm/1.1/xnm"; 
xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm";>
+<message>
+ipsec-key-management subsystem not running - not needed by configuration.
+</message>
+<reason>
+<daemon>
+ipsec-key-management
+</daemon>
+<process-not-configured/>
+</reason>
+</warning>
+<warning xmlns="http://xml.juniper.net/xnm/1.1/xnm"; 
xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm";>
+<message>
+zeroizing re1
+</message>
+</warning>
+<rpc-error>
+<error-severity>warning</error-severity>
+<error-message>
+zeroizing re0
+</error-message>
+</rpc-error>
+</rpc-reply>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/tests/unit/utils/test_config.py 
new/py-junos-eznc-2.5.4/tests/unit/utils/test_config.py
--- old/py-junos-eznc-2.5.3/tests/unit/utils/test_config.py     2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/tests/unit/utils/test_config.py     2020-10-28 
17:16:20.000000000 +0100
@@ -198,6 +198,24 @@
             ignore_warning=False,
         )
 
+    def test_config_diff_use_fast_diff(self):
+        self.conf.rpc.get_configuration = MagicMock()
+        self.conf.diff(use_fast_diff=True)
+        self.conf.rpc.get_configuration.assert_called_with(
+            {
+                "compare": "rollback",
+                "rollback": "0",
+                "format": "text",
+                "use-fast-diff": "yes",
+            },
+            ignore_warning=False,
+        )
+
+    def test_config_diff_use_fast_diff_rb_id_gt_0(self):
+        self.conf.rpc.get_configuration = MagicMock()
+        with self.assertRaises(ValueError):
+            self.conf.diff(use_fast_diff=True, rb_id=1)
+
     def test_config_diff_exception_severity_warning(self):
         rpc_xml = """
             <rpc-error>
@@ -225,7 +243,7 @@
     def test_config_pdiff(self):
         self.conf.diff = MagicMock(return_value="Stuff")
         self.conf.pdiff()
-        self.conf.diff.assert_called_once_with(0)
+        self.conf.diff.assert_called_once_with(0, False, False)
 
     def test_config_diff_rpc_timeout(self):
         ex = RpcTimeoutError(self.dev, None, 10)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/tests/unit/utils/test_ftp.py 
new/py-junos-eznc-2.5.4/tests/unit/utils/test_ftp.py
--- old/py-junos-eznc-2.5.3/tests/unit/utils/test_ftp.py        2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/tests/unit/utils/test_ftp.py        2020-10-28 
17:16:20.000000000 +0100
@@ -95,7 +95,10 @@
     @patch("ftplib.FTP.login")
     @patch("ftplib.FTP.retrbinary")
     def test_ftp_dnload_file_get_rf_filename_cb(
-        self, mock_ftp_connect, mock_ftp_login, mock_ftp_retrbinary,
+        self,
+        mock_ftp_connect,
+        mock_ftp_login,
+        mock_ftp_retrbinary,
     ):
         def callback():
             pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-junos-eznc-2.5.3/tests/unit/utils/test_sw.py 
new/py-junos-eznc-2.5.4/tests/unit/utils/test_sw.py
--- old/py-junos-eznc-2.5.3/tests/unit/utils/test_sw.py 2020-08-25 
11:35:29.000000000 +0200
+++ new/py-junos-eznc-2.5.4/tests/unit/utils/test_sw.py 2020-10-28 
17:16:20.000000000 +0100
@@ -942,8 +942,7 @@
     def test_sw_zeroize(self, mock_execute):
         mock_execute.side_effect = self._mock_manager
         self.sw._multi_MX = True
-        test_str = "System will be rebooted and may not boot without 
configuration"
-        self.assertTrue(test_str in self.sw.zeroize())
+        self.assertTrue("zeroizing" in self.sw.zeroize())
 
     @patch("jnpr.junos.Device.execute")
     def test_sw_zeroize_exception(self, mock_execute):
@@ -1002,6 +1001,8 @@
             if "path" in kwargs:
                 if kwargs["path"] == "/packages":
                     return self._read_file("file-list_dir.xml")
+            if args and self._testMethodName == "test_sw_zeroize":
+                return self._read_file("request-zeroize.xml")
             device_params = kwargs["device_params"]
             device_handler = make_device_handler(device_params)
             session = SSHSession(device_handler)


Reply via email to