Fix tests about local compute node

This commit is contained in:
Julien Duponchelle committed 2016-08-23 22:40:26 +02:00
1 parent 9231b8e991
commit bfabf3ddc8
7 files changed
+54 -75

No files matched your search

+17 -10
View File
@@ -77,16 +77,23 @@ class Controller:
"""
Save the controller configuration on disk
"""
data = {"computes": [{"host": c.host,
"name": c.name,
"port": c.port,
"protocol": c.protocol,
"user": c.user,
"password": c.password,
"compute_id": c.id
} for c in self._computes.values()],
"settings": self._settings,
"version": __version__}
data = {
"computes": [],
"settings": self._settings,
"version": __version__
}
for c in self._computes.values():
if c.id != "local":
data["computes"].append({
"host": c.host,
"name": c.name,
"port": c.port,
"protocol": c.protocol,
"user": c.user,
"password": c.password,
"compute_id": c.id
})
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
with open(self._config_file, 'w+') as f:
json.dump(data, f, indent=4)
-4
View File
@@ -96,10 +96,6 @@ class Compute:
# Websocket for notifications
self._ws = None
# It's a configuration issue if the compute is not configured to be local but the compute id is local
if compute_id == "local" and Config.instance().get_section_config("Server")["local"] is False:
raise ComputeError("The local compute is started without --local")
def _session(self):
if self._http_session is None or self._http_session.closed is True:
self._http_session = aiohttp.ClientSession()