def post(self, request, format=None): """ POST method: add a TCP Wrapper deny_info to /etc/hosts.allow """ # add tcp wrapper allow info rtninfo = business.TcpBusiness.putlistinfo(request, ALLOW_DIR) if "success" == rtninfo: return Response(util.getResult(message.RESULT_TYPE_SUCCESS, message.ADD_SUCCESS), status=status.HTTP_200_OK) else: return Response(util.getResult(message.RESULT_TYPE_ERROR, message.RESULT_TYPE_ERROR), status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def view_kernellogdetail_get(cls, request): """ Get kernel log detail. """ try: offset = int(request.GET['offset']) limit = int(request.GET['limit']) if request.GET['order'] == 'asc': desc = False else: desc = True except Exception: offset = 0 limit = 10 desc = True try: search = request.GET['search'] except Exception: search = None try: # get file detail retstr = cls.view_log_detail(limit, offset, desc, search) return True, retstr except Exception, e: logger.error(e) return False, util.getResult(message.RESULT_TYPE_ERROR, message.FILE_NOT_EXISTS)
def get(self, request, format=None): rtn_flag, rtn_tcp_info = NetworkIO.get_tcp_info() if rtn_flag: return Response(rtn_tcp_info, status=status.HTTP_200_OK) else: return Response(util.getResult(message.RESULT_TYPE_ERROR, message.RESULT_TYPE_ERROR), status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def get(self, request, format=None): rtn_flag, rtn_numastat_info = MemBusiness.get_numastat_info() if rtn_flag: return Response({"numastat": rtn_numastat_info}, status=status.HTTP_200_OK) else: return Response(util.getResult(message.RESULT_TYPE_ERROR, message.RESULT_TYPE_ERROR), status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def view_unicornlogdetail_get(cls): """ Get unicorn log detail. """ try: # get file detail retstr = cls.log_unicorn_detail() return True, retstr except Exception, e: logger.error(e) return False, util.getResult(message.RESULT_TYPE_ERROR, message.FILE_NOT_EXISTS)
def get(self, request, format=None): keys = ["all"] if request.GET.get("keys"): keys = request.GET["keys"].replace("[", "").replace("]", "").replace( "\"", "").split(",") logger.debug(keys) rtn_flag, rtn_page_info = MemBusiness.get_page_info(keys) if rtn_flag: return Response({"pageinfo": rtn_page_info}, status=status.HTTP_200_OK) else: return Response(util.getResult(message.RESULT_TYPE_ERROR, message.RESULT_TYPE_ERROR), status=status.HTTP_500_INTERNAL_SERVER_ERROR)