Deprecate Entity, EntityCollection and use subspec in network modules (#33575)

* Deprecate Entity, EntityCollection and use subspec in network modules

*  As per proposal https://github.com/ansible/proposals/issues/76
   deprecate use of Entity, EntityCollection, ComplexDict, ComplexList
   and use subspec instead.
*  Refactor ios modules
*  Refactor eos modules
*  Refactor vyos modules
*  Refactor nxos modules
*  Refactor iosxr modules
*  Add support for key in suboptions handling

* Fix CI issues
This commit is contained in:
Ganesh Nalawade 2017-12-11 20:31:25 +05:30 committed by GitHub
commit 4349b56643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 195 additions and 200 deletions

View file

@ -134,9 +134,8 @@ failed_conditions:
import time
from ansible.module_utils.network.ios.ios import run_commands
from ansible.module_utils.network.ios.ios import ios_argument_spec, check_args
from ansible.module_utils.network.ios.ios import ios_argument_spec
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.utils import ComplexList
from ansible.module_utils.network.common.parsing import Conditional
from ansible.module_utils.six import string_types
@ -149,13 +148,8 @@ def to_lines(stdout):
def parse_commands(module, warnings):
command = ComplexList(dict(
command=dict(key=True),
prompt=dict(),
answer=dict()
), module)
commands = command(module.params['commands'])
for item in list(commands):
commands = module.params['commands']
for item in commands:
if module.check_mode and not item['command'].startswith('show'):
warnings.append(
'only show commands are supported when using check mode, not '
@ -173,8 +167,14 @@ def parse_commands(module, warnings):
def main():
"""main entry point for module execution
"""
command_spec = dict(
command=dict(key=True),
prompt=dict(),
answer=dict()
)
argument_spec = dict(
commands=dict(type='list', required=True),
commands=dict(type='list', elements='dict', options=command_spec, required=True),
wait_for=dict(type='list', aliases=['waitfor']),
match=dict(default='all', choices=['all', 'any']),
@ -191,7 +191,6 @@ def main():
result = {'changed': False}
warnings = list()
check_args(module, warnings)
commands = parse_commands(module, warnings)
result['warnings'] = warnings