首页 > 代码库 > haproxy配置增删改查

haproxy配置增删改查


shutil
json


():
   quit_flag = quit_flag:
       item_list()
       choice = ().strip()
       choice == :
           backend_info = ().strip()
           result = fetch(backend_info)
           (result)
       choice == :
           back_up()
           backend_record_dict = input_json()  key backend_record_dict:
               backend = key
               record = backend_record_dict[key]
           delete(backendrecord)
       choice == :
           back_up()
           backend_record_dict = input_json()  key backend_record_dict:
               backend = key
               record = backend_record_dict[key]
           add(backendrecord)
       choice == :
           back_up()
           backend_record_dict = input_json()  key backend_record_dict:
               backend = key
               record = backend_record_dict[key]
           modify(backendrecord)
       choice == choice == :
           quit_flag = ()
       :
           ()


():
    lis = []
    (lis)


():
    shutil.copyfile()


():
    flag = fetch_list = []
    (=) f:
        line f:
            line.strip() == %():
                flag = line.strip().startswith():  flag = flag line.strip():
                fetch_list.append(line.strip())
    fetch_list


():
    flag = fetch_list = []
    (=) f:
        line f:
            line.strip() == %():
                fetch_list.append()
                flag = line.strip().startswith():  flag = flag line.strip():
                fetch_list.append(line.strip())
    fetch_list


():
    (=) old(=) new:
        flag = line old:
            line.strip().startswith() line.strip() == % :
                flag = new.write(line)
                new_line :
                    new.write(* + new_line + )
                flag line.strip().startswith():  flag = new.write(line)
                line.strip() flag:
                new.write(line)


():
    (=) old(=) new:
        flag = line old:
            line.strip().startswith() line.strip() == % :
                flag = new_line :
                    new.write(* + new_line + )
                    new.flush()
                flag line.strip().startswith():  flag = new.write(line)
                new.flush()
                line.strip() flag:
                new.write(line)
                new.flush()


():
    (=) old(=) new:
        flag = line old:
            line.strip().startswith() line.strip() == % :
                flag = flag line.strip().startswith():  flag = new.write(line)
                new.flush()
                line.strip() flag:
                new.write(line)
                new.flush()


():
    change_flag
    record_list = fetch()  record_list:  (=) old(=) new:
            line old:
                new.write(line)
            new.write(+ + )
            new.write(* + + )
        ()
        change_flag = :  record_list:
            ()
            change_flag = :  record_list.append()
            writer(record_list)
            ()
            change_flag = change_flag :  shutil.move()


():
    change_flag
    record_list = fetch1()  (record_list)
    record_list:  (.center())
        change_flag = :  record_list:
            record_list.remove()  writer1(record_list)  ()
            change_flag = :  writer2()
            ()
            change_flag = change_flag :  shutil.move()
    change_flag


():
    change_flag
    record_list = fetch1()  record_list:  (=) old(=) new:
            line old:
                new.write(line)
            new.write(+ + )
            new.write(* + + )
        change_flag = change_flag :  shutil.move()
    :  delete()
        add()
    change_flag


():
    continue_flag = continue_flag :
        backend_record = ().strip()
        :
            backend_record_dict = json.loads(backend_record)
        :
            ()
            continue_flag = backend_record_dict

__name__ == :
    main()


haproxy配置增删改查