Beispiel #1
0
	def put(self, fname, process):
		if process == "save":
			env_path = os.environ.get('image_trace')
			ret = cu.fn_config(fname, "save", self.request.body)
			self.set_header('Content-Type', 'application/json')
			jret = json.dumps(ret)
			self.set_header("Cache-control", "no-cache")
			self.write(jret)
Beispiel #2
0
    def get(self, fname, process):
        env_path = os.environ.get('image_trace')
        fname = env_path + '/' + fname
        if process == "help":
            self.set_header("Cache-control", "no-cache")
            self.render(fname)
        elif process == "get_cfg":
            ret = cu.fn_config(fname, 'get_cfg')
            self.set_header('Content-Type', 'application/json')
            jret = json.dumps(ret)
            self.set_header("Cache-control", "no-cache")
            self.write(jret)

        elif process == "getValueByKey":
            arguments = self.request.arguments
            kvs = cu.fn_config(fname, "get_kvs", arguments)
            if kvs == {}:
                ret = None
            else:
                k = arguments.keys()[0]
                if kvs[k] == '':
                    ret = None
                else:
                    ret = kvs[k]
            self.set_header("Content-type", "text/plain")
            self.set_header("Cache-control", "no-cache")
            return self.write(str(ret))

        elif process == "setValueByKey":
            ret = cu.fn_config(fname, 'alter', self.request.arguments)
            jret = json.dumps(ret)
            self.set_header('Content-Type', 'application/json')
            self.set_header('Cache-control', 'no-cache')
            self.write(jret)

        elif process == "restart":
            self.set_header('Content-Type', 'application/json')
            self.set_header("Cache-control", "no-cache")
            stdlib.send_udp_data("\x09\x01", "127.0.0.1")
            ret = {"result": "", "info": ""}
            jret = json.dumps(ret)
            self.write(jret)

        else:
            self.set_header("Cache-control", "no-cache")
            self.render(process)
Beispiel #3
0
	def get(self, fname, process):
		env_path = os.environ.get('image_trace')
		fname = env_path + '/' + fname
		if process == "help":
			self.set_header("Cache-control", "no-cache")
			self.render(fname)
		elif process == "get_cfg":
			ret = cu.fn_config(fname, 'get_cfg')	
			self.set_header('Content-Type', 'application/json')
			jret = json.dumps(ret)
			self.set_header("Cache-control", "no-cache")
			self.write(jret)

		elif process == "getValueByKey":
			arguments = self.request.arguments
			kvs = cu.fn_config(fname, "get_kvs", arguments)
			if kvs == {}:
				ret = None
			else:
				k = arguments.keys()[0]
				if kvs[k] == '':
					ret = None
				else:
					ret = kvs[k]
			self.set_header("Content-type", "text/plain")
			self.set_header("Cache-control", "no-cache")
			return self.write(str(ret))

		elif process == "setValueByKey":
			ret = cu.fn_config(fname, 'alter', self.request.arguments)
			jret = json.dumps(ret)
			self.set_header('Content-Type', 'application/json')
			self.set_header('Cache-control', 'no-cache')
			self.write(jret)

		elif process == "restart":
			self.set_header('Content-Type', 'application/json')
			self.set_header("Cache-control", "no-cache")
			stdlib.send_udp_data("\x09\x01", "127.0.0.1")	
			ret = {"result":"", "info": ""}
			jret = json.dumps(ret)
			self.write(jret)

		else:
			self.set_header("Cache-control", "no-cache")
			self.render(process)
Beispiel #4
0
    def put(self, fname, process):
        env_path = os.environ.get('image_trace')
        fname = env_path + '/' + fname

        if process == "save":
            env_path = os.environ.get('image_trace')
            ret = cu.fn_config(fname, "save", self.request.body)
            self.set_header('Content-Type', 'application/json')
            jret = json.dumps(ret)
            self.set_header("Cache-control", "no-cache")
            self.write(jret)