This commit is contained in:
@@ -6,7 +6,6 @@ from apps.kubernetes_connection.utils import scale_up,scale_down
|
|||||||
from admin_extra_buttons.api import button
|
from admin_extra_buttons.api import button
|
||||||
from core.admin import UniversalModelAdmin
|
from core.admin import UniversalModelAdmin
|
||||||
|
|
||||||
DB = 'cloudmanager_db'
|
|
||||||
|
|
||||||
|
|
||||||
@admin.action(description="scale up")
|
@admin.action(description="scale up")
|
||||||
@@ -67,23 +66,6 @@ class ActiveAtHourFilter(admin.SimpleListFilter):
|
|||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
class MultiDBModelAdmin(admin.ModelAdmin):
|
|
||||||
"""Base class that pins all admin operations to DB."""
|
|
||||||
db = DB
|
|
||||||
|
|
||||||
def get_queryset(self, request):
|
|
||||||
return super().get_queryset(request).using(self.db)
|
|
||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
|
||||||
obj.save(using=self.db)
|
|
||||||
|
|
||||||
def delete_model(self, request, obj):
|
|
||||||
obj.delete(using=self.db)
|
|
||||||
|
|
||||||
def delete_queryset(self, request, queryset):
|
|
||||||
queryset.using(self.db).delete()
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Deployment_Data)
|
@admin.register(Deployment_Data)
|
||||||
class DeploymentDataAdmin(UniversalModelAdmin):
|
class DeploymentDataAdmin(UniversalModelAdmin):
|
||||||
list_display = ('name', 'namespace', 'schedule_week', 'schedule_day', 'replicas')
|
list_display = ('name', 'namespace', 'schedule_week', 'schedule_day', 'replicas')
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
from django.apps import AppConfig
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.shortcuts import render
|
|
||||||
import requests
|
|
||||||
from proxmoxer import ProxmoxAPI
|
|
||||||
import docker
|
|
||||||
|
|
||||||
class BackofficeConfig(AppConfig):
|
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
|
||||||
name = 'backoffice'
|
|
||||||
|
|
||||||
def hello(request):
|
|
||||||
return HttpResponse('<h1>Start bookstack!</h1>')
|
|
||||||
|
|
||||||
def http_call_test(request):
|
|
||||||
url = 'http://portainer.zeus.geeraert.eu/api/auth/'
|
|
||||||
myobj = {'Username': 'admin','Password':'Xtm78*CX3mJ54g'}
|
|
||||||
|
|
||||||
x = requests.post(url, json = myobj)
|
|
||||||
|
|
||||||
print(x.text)
|
|
||||||
return HttpResponse(x.text)
|
|
||||||
|
|
||||||
def proxmox(request):
|
|
||||||
proxmox = ProxmoxAPI("proxmox.zeus.geeraert.eu", user="root@pam", password="dinner_sl@v3", verify_ssl=False)
|
|
||||||
return HttpResponse(proxmox)
|
|
||||||
|
|
||||||
def docker_call(request,action,id_docker):
|
|
||||||
print(action)
|
|
||||||
print(id_docker)
|
|
||||||
client = docker.from_env()
|
|
||||||
if action == "start":
|
|
||||||
print("nous allons start")
|
|
||||||
client.containers.get(id_docker).start()
|
|
||||||
if action == "stop":
|
|
||||||
print("nous allons stop")
|
|
||||||
client.containers.get(id_docker).stop()
|
|
||||||
|
|
||||||
return HttpResponse(client.containers.get(id_docker).status)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
def hello(request):
|
|
||||||
return HttpResponse('<h1>Hello Django!</h1>')
|
|
||||||
Reference in New Issue
Block a user