more fixes to frappy command
- frappy(main=<maincfg>) must (re)load only <maincfg> - frappy(<maincfg>) does re(load) standard stick, if available
This commit is contained in:
37
commands.py
37
commands.py
@ -146,23 +146,37 @@ def set_se_list():
|
|||||||
|
|
||||||
@usercommand
|
@usercommand
|
||||||
@helparglist('main [, stick [, addons]]')
|
@helparglist('main [, stick [, addons]]')
|
||||||
def frappy(main=None, stick=None, addons=None):
|
def frappy(*args, main=None, stick=None, addons=None):
|
||||||
"""(re)start frappy server(s) with given configs and load setup if needed
|
"""(re)start frappy server(s) with given configs and load setup if needed
|
||||||
|
|
||||||
- without argument: list running frappy servers
|
- without argument: list running frappy servers
|
||||||
- frappy('<cfg>'): if available, the standard stick is added too
|
- frappy('<cfg>'): if available, the standard stick is added too
|
||||||
- frappy(''): the stick is removed too
|
- frappy(''): the stick is removed too
|
||||||
- addons are not changed when not given!
|
- addons are not changed when not given
|
||||||
|
- frappy(main='<cfg>') # main cfg is changed, but stick is kept
|
||||||
"""
|
"""
|
||||||
if main is not None:
|
if args:
|
||||||
if stick is None:
|
if main is not None:
|
||||||
if main:
|
raise TypeError('got multiple values for main')
|
||||||
stickcfg = main + 'stick'
|
main = args[0]
|
||||||
if stickcfg in FrappyNode.available_cfg('stick'):
|
if len(args) == 1: # special case: main given as single argument
|
||||||
# if a default stick is available, start this also
|
if stick is None: # auto stick
|
||||||
stick = stickcfg
|
if main == '':
|
||||||
else:
|
stick = '' # remove stick with main
|
||||||
stick = ''
|
else:
|
||||||
|
stickcfg = main + 'stick'
|
||||||
|
if stickcfg in FrappyNode.available_cfg('stick'):
|
||||||
|
# if a default stick is available, start this also
|
||||||
|
stick = stickcfg
|
||||||
|
else:
|
||||||
|
if stick is not None:
|
||||||
|
raise TypeError('got multiple values for stick')
|
||||||
|
stick, *alist = args
|
||||||
|
if alist:
|
||||||
|
if addons is not None:
|
||||||
|
raise TypeError('got multiple values for addons')
|
||||||
|
addons = ','.join(alist)
|
||||||
|
session.log.info('frappy_start %r %r %r', main, stick, addons)
|
||||||
all_cfg = frappy_start(main=main, stick=stick, addons=addons)
|
all_cfg = frappy_start(main=main, stick=stick, addons=addons)
|
||||||
session.log.info(all_info(all_cfg))
|
session.log.info(all_info(all_cfg))
|
||||||
|
|
||||||
@ -217,6 +231,7 @@ def frappy_list(service=None):
|
|||||||
printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], session.log.info)
|
printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], session.log.info)
|
||||||
session.log.info(' ')
|
session.log.info(' ')
|
||||||
for cfgdir in bases:
|
for cfgdir in bases:
|
||||||
|
table.append('--- %s' % cfgdir)
|
||||||
for cfgfile in glob(join(cfgdir, '*.cfg')):
|
for cfgfile in glob(join(cfgdir, '*.cfg')):
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read(cfgfile)
|
parser.read(cfgfile)
|
||||||
|
Reference in New Issue
Block a user