add info about SEA cfg in listing
+ fixed: all servers should be shown, independent whether nicos list, frappy list or sea list is used
This commit is contained in:
parent
eee6c22b87
commit
4b9e0e905d
10
__init__.py
10
__init__.py
@ -95,11 +95,12 @@ class ServiceManager:
|
|||||||
all = {} # for the list command, we want to register all service managers
|
all = {} # for the list command, we want to register all service managers
|
||||||
virtualenv = None
|
virtualenv = None
|
||||||
pkg = ''
|
pkg = ''
|
||||||
|
revcmd = {}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.env = {}
|
self.env = {}
|
||||||
self.commands = {}
|
self.commands = {}
|
||||||
self.revcmd = {}
|
# self.revcmd = {}
|
||||||
self.info = {}
|
self.info = {}
|
||||||
self.all[self.group] = self
|
self.all[self.group] = self
|
||||||
#prog, args = self.command.split(None, 1)
|
#prog, args = self.command.split(None, 1)
|
||||||
@ -132,7 +133,7 @@ class ServiceManager:
|
|||||||
parser.read(expanduser('~/servman.cfg'))
|
parser.read(expanduser('~/servman.cfg'))
|
||||||
defaults = parser['DEFAULT']
|
defaults = parser['DEFAULT']
|
||||||
self.commands = {}
|
self.commands = {}
|
||||||
self.revcmd = {}
|
# self.revcmd = {}
|
||||||
|
|
||||||
for ins in parser.sections():
|
for ins in parser.sections():
|
||||||
section = dict(parser[ins])
|
section = dict(parser[ins])
|
||||||
@ -154,7 +155,7 @@ class ServiceManager:
|
|||||||
self.get_info()
|
self.get_info()
|
||||||
return self.info[ins]
|
return self.info[ins]
|
||||||
|
|
||||||
def get_cfg(self, service):
|
def get_cfg(self, ins, service):
|
||||||
"""return cfg info about running programs, if relevant
|
"""return cfg info about running programs, if relevant
|
||||||
|
|
||||||
example for sea: return samenv name
|
example for sea: return samenv name
|
||||||
@ -364,7 +365,7 @@ class ServiceManager:
|
|||||||
for serv, port in info_grp.items():
|
for serv, port in info_grp.items():
|
||||||
plist = procs_dict.get(serv)
|
plist = procs_dict.get(serv)
|
||||||
if plist:
|
if plist:
|
||||||
cfg = cfginfo.get((ins_i, serv), '') or sm.get_cfg(serv)
|
cfg = cfginfo.get((ins_i, serv), '') or sm.get_cfg(ins_i, serv)
|
||||||
if sm == self:
|
if sm == self:
|
||||||
show_ins = True
|
show_ins = True
|
||||||
gs = '%s %s' % (group, serv)
|
gs = '%s %s' % (group, serv)
|
||||||
@ -393,6 +394,7 @@ class ServiceManager:
|
|||||||
try:
|
try:
|
||||||
method(*args)
|
method(*args)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
|
raise
|
||||||
errtxt = str(e)
|
errtxt = str(e)
|
||||||
if ' do_%s(' % action in errtxt and 'argument' in errtxt:
|
if ' do_%s(' % action in errtxt and 'argument' in errtxt:
|
||||||
raise UsageError(errtxt)
|
raise UsageError(errtxt)
|
||||||
|
1
bin/sea
1
bin/sea
@ -59,5 +59,6 @@ try:
|
|||||||
run(serv, sys.argv[1:])
|
run(serv, sys.argv[1:])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
raise
|
||||||
print(repr(e))
|
print(repr(e))
|
||||||
print(''.join(USAGE))
|
print(''.join(USAGE))
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
# *****************************************************************************
|
# *****************************************************************************
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from __init__ import ServiceManager
|
from servman import ServiceManager
|
||||||
|
|
||||||
|
|
||||||
class FrappyManager(ServiceManager):
|
class FrappyManager(ServiceManager):
|
||||||
|
2
nicos.py
2
nicos.py
@ -26,7 +26,7 @@ import shutil
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
from os.path import join, abspath, dirname, expanduser, exists, islink
|
from os.path import join, abspath, dirname, expanduser, exists, islink
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from __init__ import ServiceManager
|
from servman import ServiceManager
|
||||||
|
|
||||||
|
|
||||||
ENV_KEYS = {
|
ENV_KEYS = {
|
||||||
|
14
sea.py
14
sea.py
@ -24,8 +24,8 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import termios
|
import termios
|
||||||
import subprocess
|
import subprocess
|
||||||
from __init__ import ServiceManager, ServiceDown
|
from servman import ServiceManager, ServiceDown
|
||||||
from sicsclient import sics_command
|
from servman.sicsclient import sics_command
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmd, wait=False):
|
def run_command(cmd, wait=False):
|
||||||
@ -73,11 +73,15 @@ class SeaManager(ServiceManager):
|
|||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def get_cfg(self, service):
|
def get_cfg(self, ins, service):
|
||||||
"""return cfg info about running programs, if relevant
|
"""return cfg info about running programs, if relevant
|
||||||
|
|
||||||
example for sea: return samenv name
|
return samenv name
|
||||||
"""
|
"""
|
||||||
if service != 'sea': # ignore when service == 'graph'
|
if service != 'sea': # ignore when service == 'graph'
|
||||||
|
return ''
|
||||||
try:
|
try:
|
||||||
return sics_command(('localhost', self.info['sea']['port']), 'samenv name')
|
return sics_command(('localhost', self.info[ins]['sea']), 'samenv name')
|
||||||
|
except Exception as e:
|
||||||
|
print(self.info)
|
||||||
|
return repr(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user