From f45db211e7a201ecf2458af30759c14bf6634267 Mon Sep 17 00:00:00 2001 From: yanzhangi <51999930+yanzhangi@users.noreply.github.com> Date: Wed, 18 Sep 2019 22:28:27 +0800 Subject: [PATCH] [Backport/2.9/61843]Update ce_snmp_traps to fix bugs (#62507) * Update ce_snmp_traps to fix bugs (cherry picked from commit fd11b82272561a7bdc13dc0f5978fba769c59713) * update ce_snmp_traps to fix bugs --- changelogs/fragments/61843-ce_snmp_traps-to-fix-bugs.yml | 2 ++ lib/ansible/modules/network/cloudengine/ce_snmp_traps.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/61843-ce_snmp_traps-to-fix-bugs.yml diff --git a/changelogs/fragments/61843-ce_snmp_traps-to-fix-bugs.yml b/changelogs/fragments/61843-ce_snmp_traps-to-fix-bugs.yml new file mode 100644 index 00000000000..d3de8120855 --- /dev/null +++ b/changelogs/fragments/61843-ce_snmp_traps-to-fix-bugs.yml @@ -0,0 +1,2 @@ +bugfixes: +- ce_snmp_traps - update to fix some bugs - Contrast before and after adding configuration. (https://github.com/ansible/ansible/pull/61843) diff --git a/lib/ansible/modules/network/cloudengine/ce_snmp_traps.py b/lib/ansible/modules/network/cloudengine/ce_snmp_traps.py index 6ec674c603f..06f0026b857 100644 --- a/lib/ansible/modules/network/cloudengine/ce_snmp_traps.py +++ b/lib/ansible/modules/network/cloudengine/ce_snmp_traps.py @@ -127,7 +127,7 @@ updates: from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.network.cloudengine.ce import get_config, load_config, ce_argument_spec, run_commands +from ansible.module_utils.network.cloudengine.ce import load_config, ce_argument_spec, run_commands from ansible.module_utils.connection import exec_command @@ -308,6 +308,9 @@ class SnmpTraps(object): else: del self.end_state["snmp-agent trap"] del self.end_state["undo snmp-agent trap"] + if self.end_state == self.existing: + self.changed = False + self.updates_cmd = list() def cli_load_config(self, commands): """ Load configure through cli """