예제 #1
0
def opt1():
    ''' Cadastro manual de Hosts. '''
    sair = 1
    subprocess.call('clear')
    while sair:
        l = []
        ip = raw_input('Endereco IP: ')
        host = raw_input('Nome do Host: ')
        if (ip != '') and (host != ''):
            l.append((ip, host))
            laux = dbmanager.reg_query_db('{0}{1}'.format(INSTALL_PATH, DB), l)
            dbmanager.reg_hosts_db('{0}{1}'.format(INSTALL_PATH, DB), laux)
        else:
            print 'IP ou Host vazio nao sao validos'
        print '\n0) Sair'
        print '1) Continuar cadastrando'
        try:
            sair = input('Escolher: ')
        except:
            'Opcao invalida!'
            sair = 0
예제 #2
0
def reg_hosts(l):
    laux = reg_query_db('{0}{1}'.format(settings.INSTALL_PATH, settings.DB), l)
    reg_hosts_db('{0}{1}'.format(settings.INSTALL_PATH, settings.DB), laux)