summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsaichint <saichint@cisco.com>2018-04-25 00:46:41 -0700
committerTrishna Guha <trishnaguha17@gmail.com>2018-04-25 13:16:41 +0530
commit1afec5a48e3335e7d5fe794639442dbc38e125a9 (patch)
tree86e0b13a4cebf0dcc4eadf1fe420f3525a18c4ba /lib
parent86817cdd52f9595dcb77ba2cc449726586714af3 (diff)
downloadansible-1afec5a48e3335e7d5fe794639442dbc38e125a9.tar.gz
fix nxos_snmp_community issues (#39258)
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/modules/network/nxos/nxos_snmp_community.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_community.py b/lib/ansible/modules/network/nxos/nxos_snmp_community.py
index 8c76803df4..b0c4a0cfb1 100644
--- a/lib/ansible/modules/network/nxos/nxos_snmp_community.py
+++ b/lib/ansible/modules/network/nxos/nxos_snmp_community.py
@@ -48,8 +48,7 @@ options:
- Group to which the community belongs.
acl:
description:
- - ACL name to filter snmp requests.
- default: 1
+ - ACL name to filter snmp requests or keyword 'default'.
state:
description:
- Manage the state of the resource.
@@ -150,7 +149,8 @@ def get_snmp_community(module, name):
def config_snmp_community(delta, community):
CMDS = {
'group': 'snmp-server community {0} group {group}',
- 'acl': 'snmp-server community {0} use-acl {acl}'
+ 'acl': 'snmp-server community {0} use-acl {acl}',
+ 'no_acl': 'no snmp-server community {0} use-acl {no_acl}'
}
commands = []
for k, v in delta.items():
@@ -203,6 +203,10 @@ def main():
args = dict(group=group, acl=acl)
proposed = dict((k, v) for k, v in args.items() if v is not None)
delta = dict(set(proposed.items()).difference(existing.items()))
+ if delta.get('acl') == 'default':
+ delta.pop('acl')
+ if existing.get('acl'):
+ delta['no_acl'] = existing.get('acl')
commands = []