| Server IP : 85.214.239.14 / Your IP : 216.73.216.27 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/cwd/lib/python3/dist-packages/ansible_collections/inspur/ispim/plugins/module_utils/ |
Upload File : |
# -*- coding:utf-8 -*-
# Copyright (c), Inspur isib-group, 2020
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
try:
import ism
ism_temp = True
except ImportError:
ism_temp = False
from ansible.module_utils.basic import env_fallback
from ansible.module_utils.six import iteritems
ism_provider_spec = {
'host': dict(type='str'),
'username': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])),
'password': dict(type='str', fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True),
}
ism_argument_spec = {
'provider': dict(type='dict', options=ism_provider_spec),
}
ism_top_spec = {
'host': dict(type='str'),
'username': dict(type='str'),
'password': dict(type='str', no_log=True),
}
ism_argument_spec.update(ism_top_spec)
def load_params(module):
"""load_params"""
provider = module.params.get('provider') or dict()
for key, value in iteritems(provider):
if key in ism_argument_spec:
if module.params.get(key) is None and value is not None:
module.params[key] = value
def get_connection(module):
"""get_connection"""
load_params(module)
# result = dict()
# if module.check_mode:
# result['changed'] = True
# result['state'] = 'Success'
# result['message'] = module.params['subcommand']
# else:
dict_param = module.params
if not ism_temp:
module.fail_json(msg='inspur_sdk must be installed to use this module')
result = ism.main(dict_param)
return result