From aee18ffc2734f5a88e8f3defb4f115384cd37845 Mon Sep 17 00:00:00 2001 From: YuandongXu <786018072@qq.com> Date: Sat, 29 Jun 2019 15:36:29 +0800 Subject: [PATCH] ce_snmp_target_host: update to fix bug: None has no 'lower()' function. (#57904) * update to fix bug: None has not 'lower()' function. * add a changelog fragment. * update changlog fragment. * Update 57904-ce_snmp_target_host.yml (cherry picked from commit 78c8ee9261827b991579835dcf69babd3d42ff03) --- changelogs/fragments/57904-ce_snmp_target_host.yml | 3 +++ .../modules/network/cloudengine/ce_snmp_target_host.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/57904-ce_snmp_target_host.yml diff --git a/changelogs/fragments/57904-ce_snmp_target_host.yml b/changelogs/fragments/57904-ce_snmp_target_host.yml new file mode 100644 index 00000000000..235257c2090 --- /dev/null +++ b/changelogs/fragments/57904-ce_snmp_target_host.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ce_snmp_target_host - None has no 'lower()' attribute. diff --git a/lib/ansible/modules/network/cloudengine/ce_snmp_target_host.py b/lib/ansible/modules/network/cloudengine/ce_snmp_target_host.py index 6a5f12e897d..2ab7c4463af 100644 --- a/lib/ansible/modules/network/cloudengine/ce_snmp_target_host.py +++ b/lib/ansible/modules/network/cloudengine/ce_snmp_target_host.py @@ -493,7 +493,10 @@ class SnmpTargetHost(object): same_flag = False if "interface-name" in tmp.keys(): - if tmp["interface-name"].lower() != self.interface_name.lower(): + if tmp.get("interface-name") is not None: + if tmp["interface-name"].lower() != self.interface_name.lower(): + same_flag = False + else: same_flag = False if same_flag: