Source: reclass Version: 1.4.1-1 Severity: normal Tags: upstream Hello,
when running reclass --nodeinfo on reclass that references variable which is not defined, execution will fail with wrongly handled exception where user cannot see what's wrong: Traceback (most recent call last): File "/usr/bin/reclass", line 9, in <module> load_entry_point('reclass==1.4.1', 'console_scripts', 'reclass')() File "/usr/lib/python2.7/dist-packages/reclass/cli.py", line 35, in main data = reclass.nodeinfo(options.nodename) File "/usr/lib/python2.7/dist-packages/reclass/core.py", line 136, in nodeinfo return self._nodeinfo_as_dict(nodename, self._nodeinfo(nodename)) File "/usr/lib/python2.7/dist-packages/reclass/core.py", line 122, in _nodeinfo ret.interpolate() File "/usr/lib/python2.7/dist-packages/reclass/datatypes/entity.py", line 65, in interpolate self._parameters.interpolate() File "/usr/lib/python2.7/dist-packages/reclass/datatypes/parameters.py", line 180, in interpolate self._interpolate_inner(path, refvalue) File "/usr/lib/python2.7/dist-packages/reclass/datatypes/parameters.py", line 219, in _interpolate_inner raise UndefinedVariableError(e.var, path) AttributeError: 'UndefinedVariableError' object has no attribute 'var' Correct output should be following: Cannot resolve ${_param:cluster_vip_address_local} in the context of keepalived:cluster:instance:cicd_control_vip:addresses:0 Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/reclass/datatypes/parameters.py", line 269, in _interpolate_inner new = refvalue.render(self._base) File "/usr/local/lib/python2.7/dist-packages/reclass/utils/refvalue.py", line 110, in render return self._assemble(resolver) File "/usr/local/lib/python2.7/dist-packages/reclass/utils/refvalue.py", line 97, in _assemble return resolver(self._refs[0]) File "/usr/local/lib/python2.7/dist-packages/reclass/utils/refvalue.py", line 109, in <lambda> resolver = lambda s: self._resolve(s, context) File "/usr/local/lib/python2.7/dist-packages/reclass/utils/refvalue.py", line 83, in _resolve raise UndefinedVariableError(ref) UndefinedVariableError The fix is simple and issue annoying so I would prefer fixing it and ask release team to unfreeze migration so it can be fixed in Stretch.. :-) I wanted to prepare update but git repository isn't up to date (seems that 1.4.1-1 is missing), anyway attaching patch. Please let me know what you think (I am genunix at irc.debian.org if you want to discuss in realtime). Filip -- System Information: Debian Release: 9.0 APT prefers testing APT policy: (400, 'testing'), (100, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.7.0-0.bpo.1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
From 99fe726b4826d76c29fa341c41e4f1ba549f2ad0 Mon Sep 17 00:00:00 2001 From: Filip Pytloun <fi...@pytloun.cz> Date: Fri, 10 Mar 2017 08:47:56 +0100 Subject: [PATCH] Backport UndefinedVariableError fix --- debian/changelog | 9 +++++++ debian/control | 16 +++++++---- ...edVariableError-which-had-uh-undefined-va.patch | 31 ++++++++++++++++++++++ debian/patches/series | 1 + debian/reclass.links | 2 ++ debian/watch | 3 +++ 6 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 debian/patches/0001-Fix-UndefinedVariableError-which-had-uh-undefined-va.patch create mode 100644 debian/patches/series create mode 100644 debian/reclass.links create mode 100644 debian/watch diff --git a/debian/changelog b/debian/changelog index 2b4b88a..343e586 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +reclass (1.4-2) unstable; urgency=medium + + * d/patches: backport Fix UndefinedVariableError + * d/reclass.links: add links to /usr/bin/reclass-{salt,ansible} + * add d/watch file + * Add myself as uploader + + -- Filip Pytloun <fi...@pytloun.cz> Fri, 10 Mar 2017 08:45:53 +0100 + reclass (1.4-1) unstable; urgency=low * New upstream release (closes: #761952). diff --git a/debian/control b/debian/control index 225c29f..6da6966 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,12 @@ Source: reclass Section: python Priority: extra Maintainer: martin f. krafft <madd...@debian.org> -Uploaders: Jonas Smedegaard <d...@jones.dk> -Build-Depends: python-setuptools, python, debhelper (>= 8.9.7), python-sphinx, python-yaml +Uploaders: Jonas Smedegaard <d...@jones.dk>, Filip Pytloun <fi...@pytloun.cz> +Build-Depends: debhelper (>= 8.9.7), + python, + python-setuptools, + python-sphinx, + python-yaml Standards-Version: 3.9.6 XS-Python-Version: all Homepage: http://reclass.pantsfullofunix.net/ @@ -13,7 +17,9 @@ Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/reclass.git?h=debian Package: reclass Architecture: all Section: admin -Depends: python-reclass (= ${binary:Version}), ${misc:Depends}, ${python:Depends} +Depends: python-reclass (= ${binary:Version}), + ${misc:Depends}, + ${python:Depends} Suggests: reclass-doc Description: hierarchical inventory backend for configuration management systems reclass is an "external node classifier" (ENC) as can be used with automation @@ -38,7 +44,7 @@ Description: hierarchical inventory backend for configuration management systems Package: python-reclass Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources +Depends: python-pkg-resources, ${misc:Depends}, ${python:Depends} Description: hierarchical inventory backend for configuration management systems reclass is an "external node classifier" (ENC) as can be used with automation tools, such as Puppet, Salt, and Ansible. It is also a stand-alone tool for @@ -61,7 +67,7 @@ Description: hierarchical inventory backend for configuration management systems Package: reclass-doc Architecture: all Section: doc -Depends: ${sphinxdoc:Depends}, ${misc:Depends} +Depends: ${misc:Depends}, ${sphinxdoc:Depends} Description: reclass documentation reclass is an "external node classifier" (ENC) as can be used with automation tools, such as Puppet, Salt, and Ansible. It is also a stand-alone tool for diff --git a/debian/patches/0001-Fix-UndefinedVariableError-which-had-uh-undefined-va.patch b/debian/patches/0001-Fix-UndefinedVariableError-which-had-uh-undefined-va.patch new file mode 100644 index 0000000..5928029 --- /dev/null +++ b/debian/patches/0001-Fix-UndefinedVariableError-which-had-uh-undefined-va.patch @@ -0,0 +1,31 @@ +From fbd22d42a20a0fdd53bc42fd27ad9f3d6af70f80 Mon Sep 17 00:00:00 2001 +From: Michael Kuty <6du1r...@gmail.com> +Date: Fri, 16 Oct 2015 18:10:18 +0200 +Subject: [PATCH 1/2] Fix UndefinedVariableError, which had, uh, undefined + variables + +Signed-off-by: martin f. krafft <madd...@madduck.net> +--- + reclass/errors.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/reclass/errors.py b/reclass/errors.py +index 4da2bc3..ddb95fd 100644 +--- a/reclass/errors.py ++++ b/reclass/errors.py +@@ -131,9 +131,11 @@ class UndefinedVariableError(InterpolationError): + super(UndefinedVariableError, self).__init__(msg=None) + self._var = var + self._context = context ++ var = property(lambda self: self._var) ++ context = property(lambda self: self._context) + + def _get_message(self): +- msg = "Cannot resolve " + var.join(PARAMETER_INTERPOLATION_SENTINELS) ++ msg = "Cannot resolve " + self._var.join(PARAMETER_INTERPOLATION_SENTINELS) + if self._context: + msg += ' in the context of %s' % self._context + return msg +-- +2.1.4 + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..a932daa --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Fix-UndefinedVariableError-which-had-uh-undefined-va.patch diff --git a/debian/reclass.links b/debian/reclass.links new file mode 100644 index 0000000..9a35c62 --- /dev/null +++ b/debian/reclass.links @@ -0,0 +1,2 @@ +/usr/share/reclass/reclass-ansible /usr/bin/reclass-ansible +/usr/share/reclass/reclass-salt /usr/bin/reclass-salt diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..15d1a0c --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +#opts=pgpsigurlmangle=s/$/.asc/ \ +https://pypi.debian.net/reclass/reclass-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) -- 2.11.0
signature.asc
Description: PGP signature