mirror of https://github.com/nicolargo/glances
api/4/vms returns a dict, thus breaking make test-restful #2918
parent
fbca700562
commit
6fa969adf4
|
@ -15,7 +15,7 @@ from glances.globals import iteritems
|
||||||
from glances.logger import logger
|
from glances.logger import logger
|
||||||
from glances.plugins.plugin.model import GlancesPluginModel
|
from glances.plugins.plugin.model import GlancesPluginModel
|
||||||
from glances.plugins.vms.engines import VmsExtension
|
from glances.plugins.vms.engines import VmsExtension
|
||||||
from glances.plugins.vms.engines.multipass import VmExtension, import_multipass_error_tag
|
from glances.plugins.vms.engines.multipass import VmExtension
|
||||||
from glances.processes import glances_processes
|
from glances.processes import glances_processes
|
||||||
from glances.processes import sort_stats as sort_stats_processes
|
from glances.processes import sort_stats as sort_stats_processes
|
||||||
|
|
||||||
|
@ -109,8 +109,7 @@ class PluginModel(GlancesPluginModel):
|
||||||
self.watchers: Dict[str, VmsExtension] = {}
|
self.watchers: Dict[str, VmsExtension] = {}
|
||||||
|
|
||||||
# Init the Multipass API
|
# Init the Multipass API
|
||||||
if not import_multipass_error_tag:
|
self.watchers['multipass'] = VmExtension()
|
||||||
self.watchers['multipass'] = VmExtension()
|
|
||||||
|
|
||||||
# Sort key
|
# Sort key
|
||||||
self.sort_key = None
|
self.sort_key = None
|
||||||
|
|
|
@ -30,9 +30,6 @@ class VmExtension:
|
||||||
CONTAINER_ACTIVE_STATUS = ['running']
|
CONTAINER_ACTIVE_STATUS = ['running']
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if import_multipass_error_tag:
|
|
||||||
raise Exception(f"Multipass binary ({MULTIPASS_PATH}) is mandatory to get VM stats")
|
|
||||||
|
|
||||||
self.ext_name = "Multipass (Vm)"
|
self.ext_name = "Multipass (Vm)"
|
||||||
|
|
||||||
def update_version(self):
|
def update_version(self):
|
||||||
|
@ -95,6 +92,11 @@ class VmExtension:
|
||||||
|
|
||||||
def update(self, all_tag) -> Tuple[Dict, List[Dict]]:
|
def update(self, all_tag) -> Tuple[Dict, List[Dict]]:
|
||||||
"""Update Vm stats using the input method."""
|
"""Update Vm stats using the input method."""
|
||||||
|
# Can not run multipass on this system then...
|
||||||
|
if import_multipass_error_tag:
|
||||||
|
return {}, []
|
||||||
|
|
||||||
|
# Get the stats from the system
|
||||||
version_stats = self.update_version()
|
version_stats = self.update_version()
|
||||||
|
|
||||||
# TODO: manage all_tag option
|
# TODO: manage all_tag option
|
||||||
|
|
Loading…
Reference in New Issue