Adds provider connection for bigip_facts (#44785)

This is needed because this module will be deprecated and removed
*after* the args connection method is removed.
This commit is contained in:
Tim Rupp 2018-08-28 13:31:33 -07:00 committed by GitHub
commit 47633b8d82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,9 +93,11 @@ from ansible.module_utils.six.moves import map, zip
try: try:
from library.module_utils.network.f5.legacy import bigip_api, bigsuds_found from library.module_utils.network.f5.legacy import bigip_api, bigsuds_found
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import F5BaseClient
except ImportError: except ImportError:
from ansible.module_utils.network.f5.legacy import bigip_api, bigsuds_found from ansible.module_utils.network.f5.legacy import bigip_api, bigsuds_found
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import F5BaseClient
try: try:
from suds import MethodNotFound, WebFault from suds import MethodNotFound, WebFault
@ -1652,9 +1654,10 @@ def generate_provision_dict(f5):
return generate_simple_dict(provisioned, fields) return generate_simple_dict(provisioned, fields)
def main(): class ArgumentSpec(object):
argument_spec = f5_argument_spec def __init__(self):
meta_args = dict( self.supports_check_mode = False
argument_spec = dict(
session=dict(type='bool', default='no'), session=dict(type='bool', default='no'),
include=dict( include=dict(
type='raw', type='raw',
@ -1668,20 +1671,29 @@ def main():
), ),
filter=dict(type='str'), filter=dict(type='str'),
) )
argument_spec.update(meta_args) self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
self.argument_spec.update(argument_spec)
def main():
spec = ArgumentSpec()
module = AnsibleModule( module = AnsibleModule(
argument_spec=argument_spec argument_spec=spec.argument_spec
) )
client = F5BaseClient(**module.params)
provider = client.merge_provider_params()
if not bigsuds_found: if not bigsuds_found:
module.fail_json(msg="the python suds and bigsuds modules are required") module.fail_json(msg="the python suds and bigsuds modules are required")
server = module.params['server'] server = provider['server']
server_port = module.params['server_port'] server_port = provider['server_port']
user = module.params['user'] user = provider['user']
password = module.params['password'] password = provider['password']
validate_certs = module.params['validate_certs'] validate_certs = provider['validate_certs']
session = module.params['session'] session = module.params['session']
fact_filter = module.params['filter'] fact_filter = module.params['filter']