From db5ceb23903858d203227ab119300456ad77979e Mon Sep 17 00:00:00 2001 From: YuandongXu Date: Tue, 9 Jul 2019 09:00:23 +0800 Subject: [PATCH] Backport/2.8/58200 ce_bfd_global: update to fix a bug. (#58200) (#58555) * update to fix a bug. (#58200) (cherry picked from commit 875e7c3e5036b1410e4170c4ff2589c3f12e5ac7) * add a changlog fragment to PR 58200. * Update 58200-update-ce_bfd_global-to-fix-a-bug.yml --- .../fragments/58200-update-ce_bfd_global-to-fix-a-bug.yml | 3 +++ lib/ansible/modules/network/cloudengine/ce_bfd_global.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/58200-update-ce_bfd_global-to-fix-a-bug.yml diff --git a/changelogs/fragments/58200-update-ce_bfd_global-to-fix-a-bug.yml b/changelogs/fragments/58200-update-ce_bfd_global-to-fix-a-bug.yml new file mode 100644 index 0000000000..a80a76c4f9 --- /dev/null +++ b/changelogs/fragments/58200-update-ce_bfd_global-to-fix-a-bug.yml @@ -0,0 +1,3 @@ +bugfixes: + - ce_bfd_global - line284, 'data' tag of xpath should be removed. + line498, add "self.existing == self.end_state" to compare the status and get 'changed'. diff --git a/lib/ansible/modules/network/cloudengine/ce_bfd_global.py b/lib/ansible/modules/network/cloudengine/ce_bfd_global.py index c1416013d8..d7b2d11a93 100644 --- a/lib/ansible/modules/network/cloudengine/ce_bfd_global.py +++ b/lib/ansible/modules/network/cloudengine/ce_bfd_global.py @@ -281,7 +281,7 @@ class BfdGlobal(object): root = ElementTree.fromstring(xml_str) # get bfd global info - glb = root.find("data/bfd/bfdSchGlobal") + glb = root.find("bfd/bfdSchGlobal") if glb: for attr in glb: bfd_dict["global"][attr.tag] = attr.text @@ -495,6 +495,8 @@ class BfdGlobal(object): return self.end_state["global"] = bfd_dict.get("global") + if self.existing == self.end_state: + self.changed = False def work(self): """worker"""