Esempio n. 1
0
    remove_expired: true
    serial_number: #################
    licenses:
      nfs: remove
"""

RETURN = """

"""
import traceback

from ansible_collections.notstdlib.moveitallout.plugins.module_utils.basic import AnsibleModule
from ansible_collections.notstdlib.moveitallout.plugins.module_utils._text import to_native
import ansible_collections.notstdlib.moveitallout.plugins.module_utils.netapp as netapp_utils

HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()


class NetAppCDOTLicense(object):
    def __init__(self):
        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(
                serial_number=dict(required=False, type='str', default=None),
                remove_unused=dict(default=False, type='bool'),
                remove_expired=dict(default=False, type='bool'),
                licenses=dict(default=False, type='dict'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=False)
Esempio n. 2
0
''' unit tests ONTAP Ansible module: na_ontap_nvme_namespace'''

from __future__ import print_function
import json
import pytest

from ansible_collections.notstdlib.moveitallout.tests.unit.compat import unittest
from ansible_collections.notstdlib.moveitallout.tests.unit.compat.mock import patch
from ansible_collections.notstdlib.moveitallout.plugins.module_utils import basic
from ansible_collections.notstdlib.moveitallout.plugins.module_utils._text import to_bytes
import ansible_collections.notstdlib.moveitallout.plugins.module_utils.netapp as netapp_utils

from ansible_collections.notstdlib.moveitallout.plugins.modules.na_ontap_nvme_namespace \
    import NetAppONTAPNVMENamespace as my_module

if not netapp_utils.has_netapp_lib():
    pytestmark = pytest.mark.skip('skipping as missing required netapp_lib')


def set_module_args(args):
    """prepare arguments so that they will be picked up during module creation"""
    args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
    basic._ANSIBLE_ARGS = to_bytes(args)  # pylint: disable=protected-access


class AnsibleExitJson(Exception):
    """Exception class to be raised by module.exit_json and caught by the test case"""
    pass


class AnsibleFailJson(Exception):