Example #1
0
def insert():
    info = request.get_data()
    info = json.loads(info)
    sql = 'replace into playbook (name,hosts_path, playbook_path, forks) VALUES(%s, %s, %s, %s);'
    params = ( info['name'], info['hosts_path'], info['playbook_path'], info['forks'])
    tool_db.updateByParameters( sql, params )
    return "Success"
Example #2
0
def insert():
    info = request.get_data()
    info = json.loads(info)
    # name, hosts_path, hosts_pattern, module, args, forks
    sql = 'replace into deploy (name,hosts_path, hosts_pattern, module, args, forks) VALUES(%s, %s, %s, %s, %s, %s);'
    params = (info['name'], info['hosts_path'], info['hosts_pattern'],
              info['module'], info['args'], info['forks'])
    tool_db.updateByParameters(sql, params)
    return "Success"
Example #3
0
def insertFromExcel(excelPath):
    book = xlrd.open_workbook(excelPath)
    sheet = book.sheet_by_index(0)
    rowsnumber = sheet.nrows
    colsnumber = sheet.ncols
    for i in range(0, rowsnumber):
        value = []
        for j in range(0, colsnumber):
            value.append(sheet.cell(i, j).value)
        if i != 0:
            sql = 'replace into servers (name,ip, port, user) VALUES( %s, %s, %s, %s);'
            tool_db.updateByParameters(
                sql, (value[0], value[1], value[2], value[3]))
Example #4
0
def delete_by_id():
    id = int( request.args.get('id') )
    sql = 'delete from playbook where id = %s'
    tool_db.updateByParameters( sql, (id, ) )
    return "Servers!"