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, {})
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, {})
def _parse_conf_from_rest(self):
conf_mgr = conf.ConfManager(
self.__session_key, "Splunk_TA_paloalto", scheme=self.scheme, host=self.host, port=self.port)
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})
def _parse_conf_from_rest(self):
conf_mgr = conf.ConfManager(
self.__session_key, "Splunk_TA_paloalto", scheme=self.scheme, host=self.host, port=self.port)
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})