statuf on load fixed?
This commit is contained in:
@@ -107,7 +107,11 @@ def dashboard(request):
|
||||
class ContainerStatus:
|
||||
low_limit = 80
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
def __init__(self, dev_container:DevContainer):
|
||||
self._devcontainer = dev_container
|
||||
self.vmid = dev_container.lxc.vmid
|
||||
self.lxc_status = dev_container.lxc.synced_status
|
||||
kwargs = dev_container.statuscache or {}
|
||||
self.cpus = kwargs.get('cpus', 0)
|
||||
self.cpu = kwargs.get('cpu', 0)
|
||||
self.maxmem = kwargs.get('maxmem', 256)
|
||||
@@ -117,9 +121,7 @@ class ContainerStatus:
|
||||
self.maxswap = kwargs.get('maxswap', 0)
|
||||
self.swap = kwargs.get('swap', 0)
|
||||
self.status = kwargs.get('status')
|
||||
self.vmid = kwargs.get('vmid')
|
||||
self.lease_status = kwargs.get('lease_status', 'waiting')
|
||||
self.lxc_status = kwargs.get('lxc_status', 'stopped')
|
||||
|
||||
def __hash__(self):
|
||||
return int(self.vmid)
|
||||
@@ -171,7 +173,7 @@ def container_details(request):
|
||||
with Proxmox() as pm:
|
||||
for id in ids:
|
||||
container = DevContainer.objects.get(internal_id=id)
|
||||
ret.append(ContainerStatus(**(container.statuscache or {})).to_json)
|
||||
ret.append(ContainerStatus(container).to_json)
|
||||
return HttpResponse(json.dumps(ret), content_type='application/json')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user