Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • calibration/calng
1 result
Show changes
Commits on Source (3)
...@@ -994,36 +994,33 @@ class CalibrationManager(DeviceClientBase, Device): ...@@ -994,36 +994,33 @@ class CalibrationManager(DeviceClientBase, Device):
# Query all servers on each host and check whether the ones we # Query all servers on each host and check whether the ones we
# need are in there, and obtain their API names. # need are in there, and obtain their API names.
for host, req_names in hosts.items(): for host, req_names in hosts.items():
# Retrieve hostname for nice error messages.
hostname = urlparse(self._server_hosts[name]).hostname
try: try:
reply = await to_asyncio_future(self._http_client.fetch( reply = await to_asyncio_future(self._http_client.fetch(
f'{host}/api/servers.json', method='GET')) f'{host}/api/servers.json', method='GET'))
except (ConnectionError, HTTPError) as e: except (ConnectionError, HTTPError) as e:
err.append(f'- {e.__class__.__name__} when retrieving server ' err.append(f'- {e.__class__.__name__} when retrieving server '
f'list on {hostname}: {e}') f'list on {host}: {e}')
continue continue
body = json.loads(reply.body) body = json.loads(reply.body)
if not body['success']: if not body['success']:
err.append(f'- Request to retrieve server list failed on ' err.append(f'- Request to retrieve server list failed on '
f'{hostname}') f'{host}')
continue continue
servers = {s['karabo_name']: s for s in body['servers'] servers = {s['karabo_name']: s for s in body['servers']
if s['karabo_name'] in req_names} if s['karabo_name'] in req_names}
if len(servers) != len(req_names): if len(servers) != len(req_names):
err.append(f'- Device servers missing on {hostname}: ' + err.append(f'- Device servers missing on {host}: ' +
', '.join(req_names - servers.keys())) ', '.join(req_names - servers.keys()))
servers_in_error = {s['karabo_name'] for s in servers.values() servers_in_error = {s['karabo_name'] for s in servers.values()
if 'error' in s['status']} if 'error' in s['status']}
if servers_in_error: if servers_in_error:
err.append(f'- Device servers on {hostname} are in error state' err.append(f'- Device servers on {host} are in error state'
+ ', '.join(servers_in_error)) + ', '.join(servers_in_error))
continue continue
...@@ -1031,7 +1028,7 @@ class CalibrationManager(DeviceClientBase, Device): ...@@ -1031,7 +1028,7 @@ class CalibrationManager(DeviceClientBase, Device):
if not s['control_allowed']} if not s['control_allowed']}
if servers_disabled: if servers_disabled:
err.append(f'- Device servers on {hostname} not controllable ' err.append(f'- Device servers on {host} not controllable '
f'via webserver: ' + ', '.join(servers_disabled)) f'via webserver: ' + ', '.join(servers_disabled))
continue continue
...@@ -1201,7 +1198,7 @@ class CalibrationManager(DeviceClientBase, Device): ...@@ -1201,7 +1198,7 @@ class CalibrationManager(DeviceClientBase, Device):
all_req_servers = set(server_by_group.values()).union( all_req_servers = set(server_by_group.values()).union(
server_by_layer.values()) server_by_layer.values())
if all_req_servers != up_servers: if set(all_req_servers) > set(up_servers):
return self._set_error('One or more device servers are not ' return self._set_error('One or more device servers are not '
'listed in the device servers ' 'listed in the device servers '
'configuration') 'configuration')
......