Пример #1
0
 def update_status(args):
     query_first = """
     UPDATE NODE Set status = 'disabled'
     """
     Sql.exec(query=query_first, args={})
     for ip in args:
         query = """
         UPDATE NODE SET status = 'running'
         where ip = '{ip}'
         """
         Sql.exec(query, args={'ip': ip})
     return "OK"
Пример #2
0
 def create_task_result(args):
     query = """
         INSERT INTO TaskResult(taskId, data)
         VALUES({task_id}, '{data}')
         returning id
             """
     return Sql.exec(query=query, args=args)
Пример #3
0
    def add_cert(args):
        query = """
            INSERT INTO cert (ip, status)
            VALUES('{ip}', '{status}')
            returning id
        """

        return Sql.exec(query=query, args=args)
Пример #4
0
    def create_task(args):
        query = """
            INSERT INTO tasks (nodeId, status)
            VALUES({nodeId}, '{status}')
            returning id
        """

        return Sql.exec(query=query, args=args)
Пример #5
0
    def insert_node(args):
        query = """
            INSERT INTO Node (ip,status)
            VALUES('{ip}', 'running')
            returning id
        """

        return Sql.exec(query=query, args=args)
Пример #6
0
 def get_cert_id(args):
     query = """
         SELECT id FROM cert
         where data = '{data}'
                         """
     return Sql.exec(query=query, args=args)
Пример #7
0
 def get_tasks(args):
     query = """
         SELECT * FROM TaskResult
         join Tasks t on t.id = TaskResult.taskid
             """
     return Sql.exec(query=query, args=args)
Пример #8
0
 def get_nodes(args):
     query = """
         SELECT id, status FROM Node
                         """
     return Sql.exec(query=query, args=args)