pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Fix to correctly return "set" command variant of config. Ref. https://github.com/ansible/ansible/issues/17111



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Thu Aug 25 13:33:41 2016 +0200
Changeset:	792ced7f4891f5793a08f5bec310d3341b32b44e

Modified Files:
	ansible/Makefile
	ansible/distinfo
	ansible/patches/patch-lib_ansible_module__utils_junos.py

Log Message:
Fix to correctly return "set" command variant of config.
Ref. https://github.com/ansible/ansible/issues/17111

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=792ced7f4891f5793a08f5bec310d3341b32b44e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 ansible/Makefile                                   |  2 +-
 ansible/distinfo                                   |  2 +-
 .../patch-lib_ansible_module__utils_junos.py       | 30 +++++++++++++++-------
 3 files changed, 23 insertions(+), 11 deletions(-)

diffs:
diff --git a/ansible/Makefile b/ansible/Makefile
index 24f6a7f..05f81a4 100644
--- a/ansible/Makefile
+++ b/ansible/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.9 2016/02/24 22:32:59 tty Exp $
 
 DISTNAME=	ansible-2.1.0.0
-PKGREVISION=	1
+PKGREVISION=	2
 #PKGNAME=	${PYPKGPREFIX}-${DISTNAME} # XXX: for when package is py3x-ready
 CATEGORIES=	python sysutils
 MASTER_SITES=	http://releases.ansible.com/ansible/
diff --git a/ansible/distinfo b/ansible/distinfo
index 3b70ddf..75c987a 100644
--- a/ansible/distinfo
+++ b/ansible/distinfo
@@ -24,7 +24,7 @@ SHA1 (patch-examples_ansible.cfg) = 72de9cbce69150a6718439ed46de0816fc17102c
 SHA1 (patch-examples_hosts) = d6df854be7ea6fa4978681238f722cc9698bd34e
 SHA1 (patch-lib_ansible_cli_galaxy.py) = deabc09994f6e55cd5152dc5da07e852e097b073
 SHA1 (patch-lib_ansible_constants.py) = 2749d773973d7fd93af77f4879c64aad7b2570af
-SHA1 (patch-lib_ansible_module__utils_junos.py) = c8a111b38087559f8317e1805271cbcd7886f138
+SHA1 (patch-lib_ansible_module__utils_junos.py) = bc03c774ba55aec916c6c918adcaae2dd32e13f9
 SHA1 (patch-lib_ansible_modules_core_network_junos_junos__template.py) = e0c74d47aed32e41f450dc141da9eb90a73a7f35
 SHA1 (patch-lib_ansible_modules_core_system_ping.py) = 5fbb798d79e22de60ec736a7e7e96be0fadf4b1f
 SHA1 (patch-lib_ansible_modules_core_system_setup.py) = aece6abe6b7a4464bc86a48b5a289ba04093b193
diff --git a/ansible/patches/patch-lib_ansible_module__utils_junos.py b/ansible/patches/patch-lib_ansible_module__utils_junos.py
index 542676b..5044ca7 100644
--- a/ansible/patches/patch-lib_ansible_module__utils_junos.py
+++ b/ansible/patches/patch-lib_ansible_module__utils_junos.py
@@ -1,15 +1,27 @@
 $NetBSD$
 
-Add fix related to ansible bugid 3962.
+Fix to correctly return "set" command variant of config.
+Ref. https://github.com/ansible/ansible/issues/17111
 
---- lib/ansible/module_utils/junos.py.orig	2016-05-25 13:00:55.000000000 +0000
-+++ lib/ansible/module_utils/junos.py
-@@ -261,7 +261,7 @@ class Netconf(object):
+--- lib/ansible/module_utils/junos.py.orig  2016-06-24 16:26:59.000000000 +0200
++++ lib/ansible/module_utils/junos.py    2016-08-25 11:12:20.000000000 +0200
+@@ -259,11 +259,14 @@ class Netconf(object):
+             msg = 'invalid config format... must be one of xml, text, set'
+             self._fail(msg=msg)
  
-         ele = self.rpc('get_configuration', format=config_format)
-         if config_format in ['text', 'set']:
+-        ele = self.rpc('get_configuration', format=config_format)
+-        if config_format in ['text', 'set']:
 -           return str(ele.text).strip()
-+           return unicode(ele.text).strip()
-         elif config_format == "xml":
-             return ele
+-        elif config_format == "xml":
+-            return ele
++        if config_format == 'set':
++            return self.run_commands(('show configuration | display set'))[0].strip()
++        else:
++            ele = self.rpc('get_configuration', format=config_format)
++            if config_format in ['text', 'set']:
++                return str(ele.text).strip()
++            elif config_format == "xml":
++                return ele
  
+     def rpc(self, name, format='xml', **kwargs):
+         meth = getattr(self.device.rpc, name)


Home | Main Index | Thread Index | Old Index