varios fixes at psi repo, as of 2022-02-01

Change-Id: I8cdc849126d52ef0f2f27a0faf661830aac6f874
This commit is contained in:
2022-02-02 09:57:30 +01:00
parent 5e3fb10884
commit acb3bdad6a
4 changed files with 93 additions and 52 deletions

View File

@ -27,12 +27,11 @@ import sys
import argparse
from os import path
import mlzlog
# Add import path for inplace usage
sys.path.insert(0, path.abspath(path.join(path.dirname(__file__), '..')))
from secop.lib import getGeneralConfig
from secop.logging import initLogging
from secop.server import Server
@ -60,15 +59,21 @@ def parseArgv(argv):
parser.add_argument('-c',
'--cfgfiles',
action='store',
help="comma separated list of cfg files\n"
"defaults to <name_of_the_instance>\n"
"cfgfiles given without '.cfg' extension are searched in the configuration directory,"
help="comma separated list of cfg files,\n"
"defaults to <name_of_the_instance>.\n"
"cfgfiles given without '.cfg' extension are searched in the configuration directory, "
"else they are treated as path names",
default=None)
parser.add_argument('-g',
'--gencfg',
action='store',
help="full path of general config file,\n"
"defaults to env. variable FRAPPY_CONFIG_FILE\n",
default=None)
parser.add_argument('-t',
'--test',
action='store_true',
help='Check cfg files only',
help='check cfg files only',
default=False)
return parser.parse_args(argv)
@ -80,9 +85,9 @@ def main(argv=None):
args = parseArgv(argv[1:])
loglevel = 'debug' if args.verbose else ('error' if args.quiet else 'info')
mlzlog.initLogging('secop', loglevel, getGeneralConfig()['logdir'])
srv = Server(args.name, mlzlog.log, cfgfiles=args.cfgfiles, interface=args.port, testonly=args.test)
getGeneralConfig(args.gencfg)
log = initLogging(loglevel)
srv = Server(args.name, log, cfgfiles=args.cfgfiles, interface=args.port, testonly=args.test)
if args.daemonize:
srv.start()