[WIP] add <disconnected> info
This commit is contained in:
11
devices.py
11
devices.py
@ -178,7 +178,8 @@ class FrappyConfig(Device):
|
|||||||
for service, guess in list(proposed.items()):
|
for service, guess in list(proposed.items()):
|
||||||
if guess is True:
|
if guess is True:
|
||||||
proposed.pop(service)
|
proposed.pop(service)
|
||||||
return proposed, state, remarks
|
disconnected = {k for k, v in cfgs.items() if v == '<disconnected>'}
|
||||||
|
return proposed, state + (disconnected,), remarks
|
||||||
|
|
||||||
def check_services(self):
|
def check_services(self):
|
||||||
cfgs = {}
|
cfgs = {}
|
||||||
@ -313,9 +314,11 @@ class FrappyConfig(Device):
|
|||||||
if show_server_state == 'auto':
|
if show_server_state == 'auto':
|
||||||
show_server_state = state != self._previous_shown
|
show_server_state = state != self._previous_shown
|
||||||
if show_server_state:
|
if show_server_state:
|
||||||
frappycfgs, seacfgs = state
|
frappycfgs, seacfgs, disconnected = state
|
||||||
rows = [['server', 'frappy', 'sea', '']]
|
rows = [['server', 'frappy', 'sea', '']]
|
||||||
for key, remark in remarks.items():
|
for key, remark in remarks.items():
|
||||||
|
if key in disconnected:
|
||||||
|
remark = 'disconnected'
|
||||||
rows.append([key if key in ('main', 'stick') else 'addons',
|
rows.append([key if key in ('main', 'stick') else 'addons',
|
||||||
frappycfgs.get(key, ''), seacfgs.get(key, ''), remark])
|
frappycfgs.get(key, ''), seacfgs.get(key, ''), remark])
|
||||||
wid = [max(len(v) for v in column) for column in zip(*rows)]
|
wid = [max(len(v) for v in column) for column in zip(*rows)]
|
||||||
@ -333,7 +336,7 @@ class FrappyConfig(Device):
|
|||||||
|
|
||||||
if proposed:
|
if proposed:
|
||||||
info = all_info(proposed, 'proposed configuration: ')
|
info = all_info(proposed, 'proposed configuration: ')
|
||||||
session.log.warning(info)
|
session.log.info(info)
|
||||||
session.log.warning('please consider to call: frappy.update() for above configuration')
|
session.log.warning('please consider to call: frappy.update() for above configuration')
|
||||||
if '?' in info:
|
if '?' in info:
|
||||||
session.log.warning("but create cfg files first for items marked with '?'")
|
session.log.warning("but create cfg files first for items marked with '?'")
|
||||||
@ -643,6 +646,8 @@ class FrappyNode(SecNodeDevice, Moveable):
|
|||||||
def get_info(self):
|
def get_info(self):
|
||||||
result = self.doRead() or ''
|
result = self.doRead() or ''
|
||||||
code, text = self.status()
|
code, text = self.status()
|
||||||
|
if not result and self.target:
|
||||||
|
return '<disconnected>'
|
||||||
if code == status.OK or result == '':
|
if code == status.OK or result == '':
|
||||||
return result
|
return result
|
||||||
if (code, text) == (status.ERROR, 'reconnecting'):
|
if (code, text) == (status.ERROR, 'reconnecting'):
|
||||||
|
Reference in New Issue
Block a user