From c6157049d798709a81476ad7cb854baea3c14e99 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 27 Apr 2021 15:57:57 +0200 Subject: [PATCH] fix issue with a module based on a SEA subobject Change-Id: I15102ef0e17cd4414e8699e2967292b3853d2ac0 --- secop_psi/sea.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/secop_psi/sea.py b/secop_psi/sea.py index 2ad4f90..3ac2a9d 100644 --- a/secop_psi/sea.py +++ b/secop_psi/sea.py @@ -325,6 +325,22 @@ class SeaConfigCreator(SeaClient): result.append('%s: %s' % (filename, ','.join(n for n in descr))) raise SystemExit('; '.join(result)) + @Command(StringType(), result=StringType()) + def query(self, cmd): + """a request checking for errors and accepting 0 or 1 line as result""" + errors = [] + reply = None + for line in self.request(cmd).split('\n'): + if line.strip().startswith('ERROR:'): + errors.append(line[6:].strip()) + elif reply is None: + reply = line.strip() + else: + self.log.info('SEA: superfluous reply %r to %r', reply, cmd) + if errors: + raise HardwareError('; '.join(errors)) + return reply + SEA_TO_SECOPTYPE = { 'float': FloatRange(),