def handleList(self, confInfo):
     logger.info("start list")
     conf_mgr = conf.ConfManager(scc.getMgmtUri(), self.getSessionKey())
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     # read globala and proxy settings
     all_settings = conf_mgr.all_stanzas_as_dicts(c.myta_conf)
     if not all_settings:
         all_settings = {}
     self._setNoneValues(all_settings.get(c.global_settings, {}))
     # read account credential settings
     for cred, cred_conf in self.cred_confs:
         ta_conf_mgr = ta_conf.TAConfManager(
             cred_conf, scc.getMgmtUri(), self.getSessionKey())
         ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_credential)
         creds = ta_conf_mgr.all(return_acl=False)
         if creds:
             self._setNoneValues(creds)
             all_settings.update({cred: creds})
     # read customized settings
     ta_conf_mgr = ta_conf.TAConfManager(
         c.myta_customized_conf, scc.getMgmtUri(), self.getSessionKey())
     ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_customized)
     customized_settings = ta_conf_mgr.all(return_acl=False)
     all_settings.update({c.myta_customized_settings: customized_settings})
     self._clearPasswords(all_settings, self.cred_fields)
     all_settings = json.dumps(all_settings)
     all_settings = utils.escape_json_control_chars(all_settings)
     confInfo[c.myta_settings].append(c.all_settings, all_settings)
     logger.info("end list")
Example #2
0
 def handleList(self, confInfo):
     logger.info("start list")
     conf_mgr = conf.ConfManager(scc.getMgmtUri(), self.getSessionKey())
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     # read globala and proxy settings
     all_settings = conf_mgr.all_stanzas_as_dicts(c.myta_conf)
     if not all_settings:
         all_settings = {}
     self._setNoneValues(all_settings.get(c.global_settings, {}))
     # read account credential settings
     for cred, cred_conf in self.cred_confs:
         ta_conf_mgr = ta_conf.TAConfManager(cred_conf, scc.getMgmtUri(),
                                             self.getSessionKey())
         ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_credential)
         creds = ta_conf_mgr.all(return_acl=False)
         if creds:
             self._setNoneValues(creds)
             all_settings.update({cred: creds})
     # read customized settings
     ta_conf_mgr = ta_conf.TAConfManager(c.myta_customized_conf,
                                         scc.getMgmtUri(),
                                         self.getSessionKey())
     ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_customized)
     customized_settings = ta_conf_mgr.all(return_acl=False)
     all_settings.update({c.myta_customized_settings: customized_settings})
     self._clearPasswords(all_settings, self.cred_fields)
     all_settings = json.dumps(all_settings)
     all_settings = utils.escape_json_control_chars(all_settings)
     confInfo[c.myta_settings].append(c.all_settings, all_settings)
     logger.info("end list")
Example #3
0
 def handleEdit(self, confInfo):
     logger.info("start edit")
     conf_mgr = conf.ConfManager(scc.getMgmtUri(),
                                 self.getSessionKey(),
                                 app_name=self.appName)
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     all_origin_settings = conf_mgr.all_stanzas_as_dicts(c.myta_conf)
     all_settings = utils.escape_json_control_chars(
         self.callerArgs.data[c.all_settings][0])
     all_settings = json.loads(all_settings)
     # write globala and proxy settings
     self._updateGlobalSettings(c.global_settings, all_settings,
                                all_origin_settings, conf_mgr)
     self._updateGlobalSettings(c.proxy_settings, all_settings,
                                all_origin_settings, conf_mgr)
     # write account credential settings
     for cred, conf_file in self.cred_confs:
         creds = all_settings.get(cred, {})
         if creds == c.ignore_backend_req:
             logger.info("Ignore backend rest request")
             continue
         ta_conf_mgr = ta_conf.TAConfManager(conf_file,
                                             scc.getMgmtUri(),
                                             self.getSessionKey(),
                                             appname=self.appName)
         ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_credential)
         self._updateCredentials(creds, ta_conf_mgr)
     # write customized settings
     customized_settings = all_settings.get(c.myta_customized_settings, {})
     ta_conf_mgr = ta_conf.TAConfManager(c.myta_customized_conf,
                                         scc.getMgmtUri(),
                                         self.getSessionKey(),
                                         appname=self.appName)
     ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_customized)
     self._updateCredentials(customized_settings, ta_conf_mgr)
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     logger.info("end edit")
 def handleEdit(self, confInfo):
     logger.info("start edit")
     conf_mgr = conf.ConfManager(scc.getMgmtUri(), self.getSessionKey(),
                                 app_name=self.appName)
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     all_origin_settings = conf_mgr.all_stanzas_as_dicts(c.myta_conf)
     all_settings = utils.escape_json_control_chars(
         self.callerArgs.data[c.all_settings][0])
     all_settings = json.loads(all_settings)
     # write globala and proxy settings
     self._updateGlobalSettings(c.global_settings, all_settings,
                                all_origin_settings, conf_mgr)
     # write account credential settings
     for cred, conf_file in self.cred_confs:
         creds = all_settings.get(cred, {})
         if creds == c.ignore_backend_req:
             logger.info("Ignore backend rest request")
             continue
         ta_conf_mgr = ta_conf.TAConfManager(
             conf_file, scc.getMgmtUri(), self.getSessionKey(),
             appname=self.appName)
         ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_credential)
         self._updateCredentials(creds, ta_conf_mgr)
     # write customized settings
     customized_settings = all_settings.get(c.myta_customized_settings, {})
     ta_conf_mgr = ta_conf.TAConfManager(
         c.myta_customized_conf, scc.getMgmtUri(), self.getSessionKey(),
         appname=self.appName)
     ta_conf_mgr.set_encrypt_keys(self.encrypt_fields_customized)
     self._updateCredentials(customized_settings, ta_conf_mgr)
     conf_mgr.reload_conf(c.myta_conf)
     conf_mgr.reload_conf(c.myta_credential_conf)
     conf_mgr.reload_conf(c.myta_customized_conf)
     logger.info("end edit")