From 466b039b1cb58620ab9f5814af1a9317e0822868 Mon Sep 17 00:00:00 2001 From: YuandongXu <786018072@qq.com> Date: Tue, 18 Jun 2019 11:00:12 +0800 Subject: [PATCH] backport/2.8/57269 update info-center (#57269) (#57752) * update info-center (#57269) (cherry picked from commit 4dc6faea5945fea1e9840a811e95e279ab99cba3) * add a changelog fragment fot PR 57752. --- changelogs/fragments/57752-update-info-center.yml | 2 ++ .../network/cloudengine/ce_info_center_debug.py | 4 ++-- .../network/cloudengine/ce_info_center_global.py | 14 +++++++------- .../network/cloudengine/ce_info_center_log.py | 4 ++-- .../network/cloudengine/ce_info_center_trap.py | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 changelogs/fragments/57752-update-info-center.yml diff --git a/changelogs/fragments/57752-update-info-center.yml b/changelogs/fragments/57752-update-info-center.yml new file mode 100644 index 00000000000..1478e7fc588 --- /dev/null +++ b/changelogs/fragments/57752-update-info-center.yml @@ -0,0 +1,2 @@ +bugfixes: + - update info-center to fix bugs.(https://github.com/ansible/ansible/pull/57269 ) diff --git a/lib/ansible/modules/network/cloudengine/ce_info_center_debug.py b/lib/ansible/modules/network/cloudengine/ce_info_center_debug.py index 06512c92b4a..74f69f3a6d4 100644 --- a/lib/ansible/modules/network/cloudengine/ce_info_center_debug.py +++ b/lib/ansible/modules/network/cloudengine/ce_info_center_debug.py @@ -292,7 +292,7 @@ class InfoCenterDebug(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) - global_cfg = root.findall("data/syslog/globalParam") + global_cfg = root.findall("syslog/globalParam") if global_cfg: for tmp in global_cfg: tmp_dict = dict() @@ -370,7 +370,7 @@ class InfoCenterDebug(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) - source_cfg = root.findall("data/syslog/icSources/icSource") + source_cfg = root.findall("syslog/icSources/icSource") if source_cfg: for tmp in source_cfg: tmp_dict = dict() diff --git a/lib/ansible/modules/network/cloudengine/ce_info_center_global.py b/lib/ansible/modules/network/cloudengine/ce_info_center_global.py index 01f0819a6b6..1e0758c9cdb 100644 --- a/lib/ansible/modules/network/cloudengine/ce_info_center_global.py +++ b/lib/ansible/modules/network/cloudengine/ce_info_center_global.py @@ -625,7 +625,7 @@ class InfoCenterGlobal(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) channel_info["channelInfos"] = list() - channels = root.findall("data/syslog/icChannels/icChannel") + channels = root.findall("syslog/icChannels/icChannel") if channels: for channel in channels: channel_dict = dict() @@ -716,7 +716,7 @@ class InfoCenterGlobal(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) channel_direct_info["channelDirectInfos"] = list() - dir_channels = root.findall("data/syslog/icDirChannels/icDirChannel") + dir_channels = root.findall("syslog/icDirChannels/icDirChannel") if dir_channels: for ic_dir_channel in dir_channels: channel_direct_dict = dict() @@ -806,7 +806,7 @@ class InfoCenterGlobal(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) filter_info["filterInfos"] = list() - ic_filters = root.findall("data/syslog/icFilters/icFilter") + ic_filters = root.findall("syslog/icFilters/icFilter") if ic_filters: for ic_filter in ic_filters: filter_dict = dict() @@ -894,7 +894,7 @@ class InfoCenterGlobal(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) server_ip_info["serverIpInfos"] = list() - syslog_servers = root.findall("data/syslog/syslogServers/syslogServer") + syslog_servers = root.findall("syslog/syslogServers/syslogServer") if syslog_servers: for syslog_server in syslog_servers: server_dict = dict() @@ -1065,7 +1065,7 @@ class InfoCenterGlobal(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) server_domain_info["serverAddressInfos"] = list() - syslog_dnss = root.findall("data/syslog/syslogDNSs/syslogDNS") + syslog_dnss = root.findall("syslog/syslogDNSs/syslogDNS") if syslog_dnss: for syslog_dns in syslog_dnss: dns_dict = dict() @@ -1172,7 +1172,7 @@ class InfoCenterGlobal(object): root = ElementTree.fromstring(xml_str) global_info = root.findall( - "data/syslog/globalParam") + "syslog/globalParam") if global_info: for tmp in global_info: @@ -1253,7 +1253,7 @@ class InfoCenterGlobal(object): root = ElementTree.fromstring(xml_str) logfile_info = root.findall( - "data/syslog/icLogFileInfos/icLogFileInfo") + "syslog/icLogFileInfos/icLogFileInfo") if logfile_info: for tmp in logfile_info: for site in tmp: diff --git a/lib/ansible/modules/network/cloudengine/ce_info_center_log.py b/lib/ansible/modules/network/cloudengine/ce_info_center_log.py index c3c70d2850f..4ed63ace815 100644 --- a/lib/ansible/modules/network/cloudengine/ce_info_center_log.py +++ b/lib/ansible/modules/network/cloudengine/ce_info_center_log.py @@ -274,7 +274,7 @@ class InfoCenterLog(object): root = ElementTree.fromstring(xml_str) # get global param info - glb = root.find("data/syslog/globalParam") + glb = root.find("syslog/globalParam") if glb: for attr in glb: if attr.tag in ["bufferSize", "logTimeStamp", "icLogBuffEn"]: @@ -282,7 +282,7 @@ class InfoCenterLog(object): # get info-center source info log_dict["source"] = dict() - src = root.find("data/syslog/icSources/icSource") + src = root.find("syslog/icSources/icSource") if src: for attr in src: if attr.tag in ["moduleName", "icChannelId", "icChannelName", "logEnFlg", "logEnLevel"]: diff --git a/lib/ansible/modules/network/cloudengine/ce_info_center_trap.py b/lib/ansible/modules/network/cloudengine/ce_info_center_trap.py index 7a5b5426020..49387901761 100644 --- a/lib/ansible/modules/network/cloudengine/ce_info_center_trap.py +++ b/lib/ansible/modules/network/cloudengine/ce_info_center_trap.py @@ -334,7 +334,7 @@ class InfoCenterTrap(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) - global_cfg = root.findall("data/syslog/globalParam") + global_cfg = root.findall("syslog/globalParam") if global_cfg: for tmp in global_cfg: tmp_dict = dict() @@ -417,7 +417,7 @@ class InfoCenterTrap(object): replace('xmlns="http://www.huawei.com/netconf/vrp"', "") root = ElementTree.fromstring(xml_str) - source_cfg = root.findall("data/syslog/icSources/icSource") + source_cfg = root.findall("syslog/icSources/icSource") if source_cfg: for tmp in source_cfg: tmp_dict = dict()