Skip to content

Commit 6fa969a

Browse files
committed
api/4/vms returns a dict, thus breaking make test-restful nicolargo#2918
1 parent fbca700 commit 6fa969a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

glances/plugins/vms/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from glances.logger import logger
1616
from glances.plugins.plugin.model import GlancesPluginModel
1717
from glances.plugins.vms.engines import VmsExtension
18-
from glances.plugins.vms.engines.multipass import VmExtension, import_multipass_error_tag
18+
from glances.plugins.vms.engines.multipass import VmExtension
1919
from glances.processes import glances_processes
2020
from glances.processes import sort_stats as sort_stats_processes
2121

@@ -109,8 +109,7 @@ def __init__(self, args=None, config=None):
109109
self.watchers: Dict[str, VmsExtension] = {}
110110

111111
# Init the Multipass API
112-
if not import_multipass_error_tag:
113-
self.watchers['multipass'] = VmExtension()
112+
self.watchers['multipass'] = VmExtension()
114113

115114
# Sort key
116115
self.sort_key = None

glances/plugins/vms/engines/multipass.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ class VmExtension:
3030
CONTAINER_ACTIVE_STATUS = ['running']
3131

3232
def __init__(self):
33-
if import_multipass_error_tag:
34-
raise Exception(f"Multipass binary ({MULTIPASS_PATH}) is mandatory to get VM stats")
35-
3633
self.ext_name = "Multipass (Vm)"
3734

3835
def update_version(self):
@@ -95,6 +92,11 @@ def update_info(self):
9592

9693
def update(self, all_tag) -> Tuple[Dict, List[Dict]]:
9794
"""Update Vm stats using the input method."""
95+
# Can not run multipass on this system then...
96+
if import_multipass_error_tag:
97+
return {}, []
98+
99+
# Get the stats from the system
98100
version_stats = self.update_version()
99101

100102
# TODO: manage all_tag option

0 commit comments

Comments
 (0)