From 7f87698e79e02d127b277d6f0e548e059ce7c14f Mon Sep 17 00:00:00 2001 From: YuandongXu Date: Tue, 9 Jul 2019 09:01:02 +0800 Subject: [PATCH] backport/2.8/58207 ce_bfd_view: update to fix a bug (#58207) (#58556) * update to fix a bug (#58207) (cherry picked from commit 4a6c86715a591394049f8f2e74243f2520ccc582) * add a changelog fragment to PR 58556. * Update 58207-update-ce_bfd_view-to-fix-a-bug.yml --- .../fragments/58207-update-ce_bfd_view-to-fix-a-bug.yml | 2 ++ lib/ansible/modules/network/cloudengine/ce_bfd_view.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/58207-update-ce_bfd_view-to-fix-a-bug.yml diff --git a/changelogs/fragments/58207-update-ce_bfd_view-to-fix-a-bug.yml b/changelogs/fragments/58207-update-ce_bfd_view-to-fix-a-bug.yml new file mode 100644 index 00000000000..5d7336f0bcc --- /dev/null +++ b/changelogs/fragments/58207-update-ce_bfd_view-to-fix-a-bug.yml @@ -0,0 +1,2 @@ +bugfixes: + - ce_bfd_view - line287, line293, 'data' tag of a xpath should be removed to find a element.line500, running result judgment. diff --git a/lib/ansible/modules/network/cloudengine/ce_bfd_view.py b/lib/ansible/modules/network/cloudengine/ce_bfd_view.py index d8b90c28354..d87317e0b09 100644 --- a/lib/ansible/modules/network/cloudengine/ce_bfd_view.py +++ b/lib/ansible/modules/network/cloudengine/ce_bfd_view.py @@ -284,13 +284,13 @@ class BfdView(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 # get bfd session info - sess = root.find("data/bfd/bfdCfgSessions/bfdCfgSession") + sess = root.find("bfd/bfdCfgSessions/bfdCfgSession") if sess: for attr in sess: bfd_dict["session"][attr.tag] = attr.text @@ -497,6 +497,8 @@ class BfdView(object): return self.end_state["session"] = bfd_dict.get("session") + if self.end_state == self.existing: + self.changed = False def work(self): """worker"""