Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handleEdit(self, confInfo):
logger.info("start edit setup configure.")
scheme, host, port = utils.extract_http_scheme_host_port(scc.getMgmtUri())
conf_mgr = conf.ConfManager(self.getSessionKey(), self.appName, scheme=scheme, host=host, port=port)
ta_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_conf)
customized_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_customized_conf)
all_origin_settings = ta_conf_file.get_all()
all_settings = utils.escape_json_control_chars(
self.callerArgs.data[setup_const.all_settings][0])
all_settings = json.loads(all_settings)
# write global and proxy settings
self._updateGlobalSettings(setup_const.global_settings, all_settings,
all_origin_settings, ta_conf_file)
# write customized settings
customized_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_customized_conf)
self._updateConfStanzas(all_settings.get(setup_const.myta_customized_settings, {}), customized_conf_file, self.encrypt_fields_customized)
# write account credential settings
for cred, conf_file in self.cred_confs:
cred_conf_file = get_or_create_conf_file(conf_mgr, conf_file)
creds = all_settings.get(cred, {})
if creds == setup_const.ignore_backend_req:
logger.info("Ignore backend rest request")
continue
if creds:
def handleEdit(self, confInfo):
logger.info("start edit setup configure.")
scheme, host, port = utils.extract_http_scheme_host_port(scc.getMgmtUri())
conf_mgr = conf.ConfManager(self.getSessionKey(), self.appName, scheme=scheme, host=host, port=port)
ta_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_conf)
customized_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_customized_conf)
all_origin_settings = ta_conf_file.get_all()
all_settings = utils.escape_json_control_chars(
self.callerArgs.data[setup_const.all_settings][0])
all_settings = json.loads(all_settings)
# write global and proxy settings
self._updateGlobalSettings(setup_const.global_settings, all_settings,
all_origin_settings, ta_conf_file)
# write customized settings
customized_conf_file = get_or_create_conf_file(conf_mgr, setup_const.myta_customized_conf)
self._updateConfStanzas(all_settings.get(setup_const.myta_customized_settings, {}), customized_conf_file, self.encrypt_fields_customized)
# write account credential settings
for cred, conf_file in self.cred_confs:
cred_conf_file = get_or_create_conf_file(conf_mgr, conf_file)
creds = all_settings.get(cred, {})
if creds == setup_const.ignore_backend_req:
logger.info("Ignore backend rest request")
continue
if creds:
# read account credential settings
for cred, cred_conf in self.cred_confs:
cred_conf_file = get_or_create_conf_file(conf_mgr, cred_conf)
creds = cred_conf_file.get_all()
if creds:
self._setNoneValues(creds)
all_settings.update({cred: creds})
# customized conf
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._clearPasswords(all_settings, self.cred_fields)
all_settings = filter_eai_property(all_settings)
all_settings = json.dumps(all_settings)
all_settings = utils.escape_json_control_chars(all_settings)
confInfo[setup_const.myta_settings].append(setup_const.all_settings, all_settings)
logger.info("list setup configure is done.")
# read account credential settings
for cred, cred_conf in self.cred_confs:
cred_conf_file = get_or_create_conf_file(conf_mgr, cred_conf)
creds = cred_conf_file.get_all()
if creds:
self._setNoneValues(creds)
all_settings.update({cred: creds})
# customized conf
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._clearPasswords(all_settings, self.cred_fields)
all_settings = filter_eai_property(all_settings)
all_settings = json.dumps(all_settings)
all_settings = utils.escape_json_control_chars(all_settings)
confInfo[setup_const.myta_settings].append(setup_const.all_settings, all_settings)
logger.info("list setup configure is done.")