[Backport/2.9/61842]Update ce_snmp_target_host to fix bugs (#62509)

* Update ce_snmp_target_host to fix bugs

(cherry picked from commit 76016f9988)

* update ce_snmp_target_host to fix bugs
pull/62524/head
yanzhangi 5 years ago committed by Toshio Kuratomi
parent f45db211e7
commit c202f39f47

@ -0,0 +1,2 @@
bugfixes:
- ce_snmp_target_host - update to fix some bugs - Contrast before and after adding configuration. (https://github.com/ansible/ansible/pull/61842)

@ -405,7 +405,7 @@ class SnmpTargetHost(object):
find_flag = False find_flag = False
for item in INTERFACE_TYPE: for item in INTERFACE_TYPE:
if item in self.interface_name: if item in self.interface_name.lower():
find_flag = True find_flag = True
break break
if not find_flag: if not find_flag:
@ -629,6 +629,9 @@ class SnmpTargetHost(object):
if self.host_name: if self.host_name:
self.end_state["target host info"] = self.end_netconf_cfg[ self.end_state["target host info"] = self.end_netconf_cfg[
"target_host_info"] "target_host_info"]
if self.existing == self.end_state:
self.changed = False
self.updates_cmd = list()
def config_version_cli(self): def config_version_cli(self):
""" Config version by cli """ """ Config version by cli """
@ -815,8 +818,10 @@ class SnmpTargetHost(object):
if not self.address: if not self.address:
cmd = "undo snmp-agent target-host host-name %s " % self.host_name cmd = "undo snmp-agent target-host host-name %s " % self.host_name
else: else:
if self.notify_type == "trap":
cmd = "undo snmp-agent target-host trap address udp-domain %s " % self.address cmd = "undo snmp-agent target-host trap address udp-domain %s " % self.address
else:
cmd = "undo snmp-agent target-host inform address udp-domain %s " % self.address
if self.recv_port: if self.recv_port:
cmd += "udp-port %s " % self.recv_port cmd += "udp-port %s " % self.recv_port
if self.interface_name: if self.interface_name:

Loading…
Cancel
Save