Пример #1
0
def live(host=None):
    if host==None:
        global table
        table = cnc.getTableName()
        list1=list()
        con_db = mdb.connect(host=my_Host, user=my_User, passwd=my_Passwd, db=my_Db)
        with con_db:
            cur=con_db.cursor(mdb.cursors.DictCursor)
            cur.execute("SELECT "+column_b+" FROM "+table+" WHERE NOT "+column_b+" <=> '' AND "+column_f+"='Online'")
            rows=cur.fetchall()
            for row in rows:
                list1.append(row[column_b])
        conn=boto.connect_ec2()
        reservations=conn.get_all_instances(instance_ids=list1)
        list2=[inst.public_dns_name for reserv in reservations for inst in reserv.instances]
        env.hosts=list2 #this is really all we want from this
    else:
        env.hosts=[host]
Пример #2
0
def setup():
    global table
    table = cnc.getTableName()
    list1=list()
    lives=''
    #tempPath="/root/socialscan.config"
    con_db = mdb.connect(host=my_Host, user=my_User, passwd=my_Passwd, db=my_Db)
    with con_db:
        cur=con_db.cursor(mdb.cursors.DictCursor)
        cur.execute("SELECT "+column_e+" FROM "+table+" WHERE NOT "+column_e+" <=> ''")
        rows=cur.fetchall()
        for row in rows:
            list1.append(row[column_e])
    for k in list1:
        lives=lives+str(k)+' '
    with cd('socialscan'):
        #run('git pull')
        run('rm database.db >> errorfile.txt')
        run('python testutils.py makepeers '+lives+' >> errorfile.txt')
        run('cp database.db bdatabase.db >> errorfile.txt')