allow quiet SEA requests
SECoP read -> SEA hval should be quiet on the log file Change-Id: Ie020b02ef62e5792ca60e08fe72b420a6377efee
This commit is contained in:
parent
f276b973f5
commit
7b9d2d1701
@ -163,7 +163,7 @@ class SeaClient(ProxyClient, Module):
|
||||
self._connect_thread = None
|
||||
mkthread(self._rxthread, started_callback)
|
||||
|
||||
def request(self, command):
|
||||
def request(self, command, quiet=False):
|
||||
"""send a request and wait for reply"""
|
||||
with self._write_lock:
|
||||
if not self.syncio or not self.syncio.connection:
|
||||
@ -181,7 +181,8 @@ class SeaClient(ProxyClient, Module):
|
||||
print('connected to %s' % self.uri)
|
||||
self.syncio.flush_recv()
|
||||
# print('> %s' % command)
|
||||
self.syncio.writeline(('fulltransact %s' % command).encode())
|
||||
ft = 'fulltransAct' if quiet else 'fulltransact'
|
||||
self.syncio.writeline(('%s %s' % (ft, command)).encode())
|
||||
result = None
|
||||
deadline = time.time() + 10
|
||||
while time.time() < deadline:
|
||||
@ -292,11 +293,11 @@ class SeaClient(ProxyClient, Module):
|
||||
return reply
|
||||
|
||||
@Command(StringType(), result=StringType())
|
||||
def query(self, cmd):
|
||||
def query(self, cmd, quiet=False):
|
||||
"""a request checking for errors and accepting 0 or 1 line as result"""
|
||||
errors = []
|
||||
reply = None
|
||||
for line in self.request(cmd).split('\n'):
|
||||
for line in self.request(cmd, quiet).split('\n'):
|
||||
if line.strip().startswith('ERROR:'):
|
||||
errors.append(line[6:].strip())
|
||||
elif reply is None:
|
||||
@ -408,6 +409,7 @@ class SeaModule(Module):
|
||||
if issubclass(cls, SeaWritable):
|
||||
if paramdesc.get('readonly', True):
|
||||
raise ConfigError('%s/%s is not writable' % (sea_object, paramdesc['path']))
|
||||
params.insert(0, paramdesc.copy()) # copy value
|
||||
paramdesc['key'] = 'target'
|
||||
paramdesc['readonly'] = False
|
||||
extra_module_set = ()
|
||||
@ -543,7 +545,7 @@ class SeaModule(Module):
|
||||
# print('override %s.read_%s' % (cls.__name__, key))
|
||||
|
||||
def rfunc(self, cmd='hval %s/%s' % (base, path)):
|
||||
reply = self.io.query(cmd)
|
||||
reply = self.io.query(cmd, True)
|
||||
try:
|
||||
reply = float(reply)
|
||||
except ValueError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user