mirror of https://github.com/jumpserver/jumpserver
fix: 修复 component status 获取key error 问题
parent
7cf6e54f01
commit
50e6c96358
|
@ -6,10 +6,14 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
|
|
||||||
|
from common.utils import get_logger
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from .. import const
|
from .. import const
|
||||||
|
|
||||||
|
|
||||||
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
class ComputeStatusMixin:
|
class ComputeStatusMixin:
|
||||||
|
|
||||||
# system status
|
# system status
|
||||||
|
@ -40,7 +44,11 @@ class ComputeStatusMixin:
|
||||||
]
|
]
|
||||||
system_status = []
|
system_status = []
|
||||||
for system_status_key in system_status_keys:
|
for system_status_key in system_status_keys:
|
||||||
state_value = state[system_status_key]
|
state_value = state.get(system_status_key)
|
||||||
|
if state_value is None:
|
||||||
|
msg = 'state: {}, state_key: {}, state_value: {}'
|
||||||
|
logger.debug(msg.format(state, system_status_key, state_value))
|
||||||
|
state_value = 0
|
||||||
status = getattr(self, f'_compute_{system_status_key}_status')(state_value)
|
status = getattr(self, f'_compute_{system_status_key}_status')(state_value)
|
||||||
system_status.append(status)
|
system_status.append(status)
|
||||||
return system_status
|
return system_status
|
||||||
|
|
Loading…
Reference in New Issue