Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ta_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_conf)
credential_conf_file = get_or_create_conf_file(
conf_mgr, setup_const.myta_credential_conf)
# read global and proxy settings
all_settings = ta_conf_file.get_all()
if not all_settings:
all_settings = {}
self._setNoneValues(all_settings.get(setup_const.global_settings, {}))
# read account credential settings
for cred, cred_conf in self.cred_confs:
try:
cred_conf_file = get_or_create_conf_file(conf_mgr, cred_conf)
creds_data = cred_conf_file.get_all()
self._setNoneValues(creds_data)
all_settings.update({cred: creds_data})
except conf.ConfManagerException as e:
self.log_info('Conf {} not found.'.format(cred))
# read customized settings
customized_conf_file = get_or_create_conf_file(
conf_mgr, setup_const.myta_customized_conf)
settings = customized_conf_file.get_all()
all_settings[setup_const.myta_customized_settings] = settings
self._setNoneValues(all_settings.get(
setup_const.myta_customized_settings, {}))
return filter_eai_property(all_settings)
ta_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_conf)
credential_conf_file = get_or_create_conf_file(
conf_mgr, setup_const.myta_credential_conf)
# read global and proxy settings
all_settings = ta_conf_file.get_all()
if not all_settings:
all_settings = {}
self._setNoneValues(all_settings.get(setup_const.global_settings, {}))
# read account credential settings
for cred, cred_conf in self.cred_confs:
try:
cred_conf_file = get_or_create_conf_file(conf_mgr, cred_conf)
creds_data = cred_conf_file.get_all()
self._setNoneValues(creds_data)
all_settings.update({cred: creds_data})
except conf.ConfManagerException as e:
self.log_info('Conf {} not found.'.format(cred))
# read customized settings
customized_conf_file = get_or_create_conf_file(
conf_mgr, setup_const.myta_customized_conf)
settings = customized_conf_file.get_all()
all_settings[setup_const.myta_customized_settings] = settings
self._setNoneValues(all_settings.get(
setup_const.myta_customized_settings, {}))
return filter_eai_property(all_settings)
def get_or_create_conf_file(conf_mgr, file_name):
try:
conf_file = conf_mgr.get_conf(file_name)
return conf_file
except conf.ConfManagerException as cme:
conf_mgr._confs.create(file_name)
return conf_mgr.get_conf(file_name, refresh=True)
def get_or_create_conf_file(conf_mgr, file_name):
try:
conf_file = conf_mgr.get_conf(file_name)
return conf_file
except conf.ConfManagerException as cme:
conf_mgr._confs.create(file_name)
return conf_mgr.get_conf(file_name, refresh=True)