* Add intentional test coverage for lib/ansible/plugins/inventory/__init__.py * Add intentional (integration) test coverage for lib/ansible/module_utils/common/network.py * Add ansible_release info test from https://github.com/ansible/ansible/pull/74673 ci_complete ci_coverage Co-authored-by: Rick Elrod <rick@elrod.me>
29 lines
793 B
Python
29 lines
793 B
Python
#!/usr/bin/python
|
|
|
|
# Copyright: (c) 2021, Ansible Project
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
__metaclass__ = type
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
from ansible.module_utils.common.network import to_subnet
|
|
|
|
|
|
def main():
|
|
module = AnsibleModule(argument_spec=dict(
|
|
subnet=dict(),
|
|
))
|
|
|
|
subnet = module.params['subnet']
|
|
|
|
if subnet is not None:
|
|
split_addr = subnet.split('/')
|
|
if len(split_addr) != 2:
|
|
module.fail_json("Invalid CIDR notation: expected a subnet mask (e.g. 10.0.0.0/32)")
|
|
module.exit_json(resolved=to_subnet(split_addr[0], split_addr[1]))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|