summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <privateip@users.noreply.github.com>2016-09-04 20:59:32 -0400
committerGitHub <noreply@github.com>2016-09-04 20:59:32 -0400
commit3079d6ff2981a3bc2a57767ce7db1f4a23ab8246 (patch)
tree8e82a0056ac71b1596f3a9da4bdc667e8fcd9fcb
parent7b4f78798e5fa46fdd5e4f66a7f2ebe61dc11fb3 (diff)
parent10e8cdc93a56c9e20a86e99e3a3e471d6a32a1a2 (diff)
downloadansible-modules-extras-3079d6ff2981a3bc2a57767ce7db1f4a23ab8246.tar.gz
Merge pull request #2851 from privateip/asa_acl
roll up updates to asa_acl module
-rw-r--r--network/asa/asa_acl.py36
1 files changed, 11 insertions, 25 deletions
diff --git a/network/asa/asa_acl.py b/network/asa/asa_acl.py
index 6ef3b7d6..1ac0461e 100644
--- a/network/asa/asa_acl.py
+++ b/network/asa/asa_acl.py
@@ -128,6 +128,8 @@ responses:
type: list
sample: ['...', '...']
"""
+from ansible.module_utils.netcfg import NetworkConfig
+from ansible.module_utils.asa import NetworkModule
def get_config(module):
@@ -166,8 +168,8 @@ def main():
config=dict()
)
- module = get_module(argument_spec=argument_spec,
- supports_check_mode=True)
+ module = NetworkModule(argument_spec=argument_spec,
+ supports_check_mode=True)
lines = module.params['lines']
@@ -179,38 +181,22 @@ def main():
module.filter = check_input_acl(lines, module)
if not module.params['force']:
- contents = get_config(module)
- config = NetworkConfig(contents=contents, indent=1)
-
- candidate = NetworkConfig(indent=1)
- candidate.add(lines)
-
- commands = candidate.difference(config, match=match, replace=replace)
+ commands = candidate.difference(config)
+ commands = dumps(commands, 'commands').split('\n')
+ commands = [str(c) for c in commands if c]
else:
- commands = []
- commands.extend(lines)
-
- result = dict(changed=False)
+ commands = str(candidate).split('\n')
if commands:
- if before:
- commands[:0] = before
-
- if after:
- commands.extend(after)
-
if not module.check_mode:
- commands = [str(c).strip() for c in commands]
- response = module.configure(commands)
+ response = module.config(commands)
result['responses'] = response
result['changed'] = True
result['updates'] = commands
+
module.exit_json(**result)
-from ansible.module_utils.basic import *
-from ansible.module_utils.shell import *
-from ansible.module_utils.netcfg import *
-from ansible.module_utils.asa import *
+
if __name__ == '__main__':
main()