def post(self, user): request = tornado_utils.get_request_body(self) config = request.get('config') try: self.application.config_service.create_config(user, config) except (InvalidConfigException) as e: raise tornado.web.HTTPError(422, reason=str(e))
def put(self, user): request = tornado_utils.get_request_body(self) config = request.get('config') filename = request.get('filename') try: self.application.config_service.update_config(user, config, filename) except (InvalidConfigException, InvalidFileException) as e: raise tornado.web.HTTPError(422, str(e))
def put(self, user): request = tornado_utils.get_request_body(self) config = request.get('config') filename = request.get('filename') try: self.application.config_service.update_config(user, config, filename) except (InvalidConfigException, InvalidFileException) as e: raise tornado.web.HTTPError(422, str(e)) except ConfigNotAllowedException: LOGGER.warning('Admin access to the script "' + config['name'] + '" is denied for ' + user.get_audit_name()) respond_error(self, 403, 'Access to the script is denied') return
def post(self): body = tornado_utils.get_request_body(self) files = body.get('files', {}) if files: del body['files'] LOGGER.info('ReceiveAlertHandler. Received alert: ' + str(body)) for key, value in files.items(): filename = str(time.time()) + '_' + key LOGGER.info('ReceiveAlertHandler. Writing file ' + filename) file_path = os.path.join('logs', 'alerts', filename) file_utils.write_file(file_path, value)