Exemplo n.º 1
0
def instances(request):
    import infomations
    infos = infomations.listServerFuntion()
    name = infomations.getlistTenantsName()
    id_tenant = infomations.getlistIdTenant()
    hd = ['Hostname','ID','Int IP','Image ID','Status','Actions']
    kq = zip(name, infos, id_tenant)
    if request.method == "POST":
        if 'reboot' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.rebootmayao(tenantid,instanceid)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'start' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.startmayao(tenantid,instanceid)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        
        elif 'shutdown' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.shutdownmayao(tenantid,instanceid)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'pause' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.pausemayao(tenantid,instanceid)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'reboot_tenant' in request.POST:
            import actions
            tenant_id = request.POST['reboot_tenant']
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i, j in lst:
                if i == tenant_id:
                    lst_instance = j
                    break
            actions.reboot_tenant(tenant_id,lst_instance)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'reboot_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i,j in lst:
                actions.reboot_tenant(i,j)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'start_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i,j in lst:
                actions.start_tenant(i,j)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
        elif 'shutdown_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i,j in lst:
                actions.shutdown_tenant(i,j)
            return render(request,'instances.html' ,{'hd': hd, 'kq': kq})
    else:
        return render(request,'instances.html', {'hd': hd, 'kq': kq})
Exemplo n.º 2
0
import actions
import infomations
tenant_id = '6fd37089723348a2881386c27ad7dcbd'
lst_id_tenant = infomations.getlistIdTenant()
instances_id = infomations.listIdServerFuntion()
lst = zip(lst_id_tenant, instances_id)
for i, j in lst:
    if i == tenant_id:
        lst_instance = j
        break
print lst_id_tenant
print instances_id
print lst_instance
Exemplo n.º 3
0
import actions
import infomations

tenant_id = '6fd37089723348a2881386c27ad7dcbd'
lst_id_tenant = infomations.getlistIdTenant()
instances_id = infomations.listIdServerFuntion()
lst = zip(lst_id_tenant, instances_id)
for i, j in lst:
    if i == tenant_id:
        lst_instance = j
        break
print lst_id_tenant
print instances_id
print lst_instance
Exemplo n.º 4
0
def instances(request):
    import infomations
    infos = infomations.listServerFuntion()
    name = infomations.getlistTenantsName()
    id_tenant = infomations.getlistIdTenant()
    hd = ['Hostname', 'ID', 'Int IP', 'Image ID', 'Status', 'Actions']
    kq = zip(name, infos, id_tenant)
    if request.method == "POST":
        if 'reboot' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.rebootmayao(tenantid, instanceid)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'start' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.startmayao(tenantid, instanceid)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})

        elif 'shutdown' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.shutdownmayao(tenantid, instanceid)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'pause' in request.POST:
            import actions
            instanceid = request.POST['instanceid']
            tenantid = request.POST['tenantid']
            actions.pausemayao(tenantid, instanceid)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'reboot_tenant' in request.POST:
            import actions
            tenant_id = request.POST['reboot_tenant']
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i, j in lst:
                if i == tenant_id:
                    lst_instance = j
                    break
            actions.reboot_tenant(tenant_id, lst_instance)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'reboot_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i, j in lst:
                actions.reboot_tenant(i, j)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'start_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i, j in lst:
                actions.start_tenant(i, j)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
        elif 'shutdown_all' in request.POST:
            import actions
            lst_id_tenant = infomations.getlistIdTenant()
            instances_id = infomations.listIdServerFuntion()
            lst = zip(lst_id_tenant, instances_id)
            for i, j in lst:
                actions.shutdown_tenant(i, j)
            return render(request, 'instances.html', {'hd': hd, 'kq': kq})
    else:
        return render(request, 'instances.html', {'hd': hd, 'kq': kq})