MCPcopy Create free account
hub / github.com/adobe/Marinus / InfobloxConnector

Class InfobloxConnector

python3_cron_scripts/libs3/InfobloxConnector.py:25–74  ·  view source on GitHub ↗

This class is designed to manage Infoblox connection data. It is assumed that the requests to Infoblox will be done by the individual scripts.

Source from the content-addressed store, hash-verified

23
24
25class InfobloxConnector(object):
26 """
27 This class is designed to manage Infoblox connection data.
28
29 It is assumed that the requests to Infoblox will be done by
30 the individual scripts.
31 """
32
33 iblox_config_file = "connector.config"
34 _logger = None
35 HOST = ""
36 UNAME = ""
37 PASSWD = ""
38 VERSION = ""
39
40 def _log(self):
41 """
42 Get the log
43 """
44 return logging.getLogger(__name__)
45
46 def __init_iblox_connection(self, config):
47 self.HOST = ConnectorUtil.get_config_setting(
48 self._logger, config, "Infoblox", "infoblox.HOST"
49 )
50 self.UNAME = ConnectorUtil.get_config_setting(
51 self._logger, config, "Infoblox", "infoblox.username"
52 )
53 self.PASSWD = ConnectorUtil.get_config_setting(
54 self._logger, config, "Infoblox", "infoblox.passwd"
55 )
56 self.VERSION = ConnectorUtil.get_config_setting(
57 self._logger, config, "Infoblox", "infoblox.version"
58 )
59
60 def __init__(self, config_file="", log_level=None):
61 if config_file != "":
62 self.iblox_config_file = config_file
63
64 self._logger = self._log()
65 if log_level is not None:
66 self._logger.setLevel(log_level)
67
68 config = configparser.ConfigParser()
69 list = config.read(self.iblox_config_file)
70 if len(list) == 0:
71 self._logger.error("Error: Could not find the config file")
72 exit(1)
73
74 self.__init_iblox_connection(config)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected