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
parent a23da23491
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

@ -575,6 +575,21 @@ class TestModuleUtilsBasic(ModuleTestCase):
supports_check_mode=True,
)
# should test ok, handles key argument
key_spec = dict(foo=dict(key=True), bar=dict())
args = json.dumps(dict(ANSIBLE_MODULE_ARGS={'foobar': ['test-1', 'test-2']}))
with swap_stdin_and_argv(stdin_data=args):
basic._ANSIBLE_ARGS = None
am = basic.AnsibleModule(
argument_spec=dict(foobar=dict(type='list', elements='dict', options=key_spec, required=True)),
no_log=True,
check_invalid_arguments=False,
add_file_common_args=True,
supports_check_mode=True
)
self.assertEqual(am.params['foobar'][0]['foo'], 'test-1')
self.assertEqual(am.params['foobar'][1]['foo'], 'test-2')
def test_module_utils_basic_ansible_module_type_check(self):
from ansible.module_utils import basic