mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
25394eeafb
* Fix ovirt collection name (ovirt.ovirt_collection, not ovirt.ovirt). * Fix kubernetes module_utils references. * Fix broken f5 imports on community.general side. The imports in that collection are still broken and will still cause failures. * Fix Cisco ACI and MSO modules imports. * Fix check_point.mgmt dependency, fix imports. * Fix fortimanager imports. * Fix cisco intersight imports. * Fix ovirt module docs fragments. * Fix usage of _ in unit tests to avoid sanity failures. * Fix Cisco module docs fragments. * Fix netapp.ontap module docs fragment name. * Fix documentation. * Fix some boilerplate (the ones not mentioned in ignore.txt).
57 lines
2.1 KiB
Python
57 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (c) 2017 F5 Networks Inc.
|
|
# 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
|
|
|
|
|
|
import time
|
|
|
|
try:
|
|
from f5.iworkflow import ManagementRoot
|
|
from icontrol.exceptions import iControlUnexpectedHTTPError
|
|
HAS_F5SDK = True
|
|
except ImportError:
|
|
HAS_F5SDK = False
|
|
|
|
try:
|
|
from library.module_utils.network.f5.common import F5BaseClient
|
|
from library.module_utils.network.f5.common import F5ModuleError
|
|
except ImportError:
|
|
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import F5BaseClient
|
|
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import F5ModuleError
|
|
|
|
|
|
class F5Client(F5BaseClient):
|
|
@property
|
|
def api(self):
|
|
exc = None
|
|
if self._client:
|
|
return self._client
|
|
for x in range(0, 3):
|
|
try:
|
|
server = self.params['provider']['server'] or self.params['server']
|
|
user = self.params['provider']['user'] or self.params['user']
|
|
password = self.params['provider']['password'] or self.params['password']
|
|
server_port = self.params['provider']['server_port'] or self.params['server_port'] or 443
|
|
validate_certs = self.params['provider']['validate_certs'] or self.params['validate_certs']
|
|
|
|
result = ManagementRoot(
|
|
server,
|
|
user,
|
|
password,
|
|
port=server_port,
|
|
verify=validate_certs,
|
|
token='local'
|
|
)
|
|
self._client = result
|
|
return self._client
|
|
except Exception as ex:
|
|
exc = ex
|
|
time.sleep(3)
|
|
error = 'Unable to connect to {0} on port {1}.'.format(self.params['server'], self.params['server_port'])
|
|
if exc is not None:
|
|
error += ' The reported error was "{0}".'.format(str(exc))
|
|
raise F5ModuleError(error)
|