mirror of
https://github.com/SystemRage/py-kms.git
synced 2024-11-22 16:25:37 +01:00
fix#83 and some parsing cases
This commit is contained in:
parent
771b70d376
commit
d5fa609de5
@ -406,9 +406,9 @@ def kms_parser_check_optionals(userarg, zeroarg, onearg, msg = 'optional py-kms
|
|||||||
if elem and elem not in allarg:
|
if elem and elem not in allarg:
|
||||||
raise KmsParserException("%s argument `" %msg + found + "`:" + " expected " + num + " unrecognized: '%s'" %elem)
|
raise KmsParserException("%s argument `" %msg + found + "`:" + " expected " + num + " unrecognized: '%s'" %elem)
|
||||||
|
|
||||||
def kms_parser_check_positionals(config, parse_method, arguments = None, msg = 'positional py-kms server'):
|
def kms_parser_check_positionals(config, parse_method, arguments = [], force_parse = False, msg = 'positional py-kms server'):
|
||||||
try:
|
try:
|
||||||
if arguments:
|
if arguments or force_parse:
|
||||||
config.update(vars(parse_method(arguments)))
|
config.update(vars(parse_method(arguments)))
|
||||||
else:
|
else:
|
||||||
config.update(vars(parse_method()))
|
config.update(vars(parse_method()))
|
||||||
|
@ -69,7 +69,6 @@ class KeyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
|||||||
selector.register(fileobj = self, events = selectors.EVENT_READ)
|
selector.register(fileobj = self, events = selectors.EVENT_READ)
|
||||||
# self-pipe trick.
|
# self-pipe trick.
|
||||||
selector.register(fileobj = self.r_service.fileno(), events = selectors.EVENT_READ)
|
selector.register(fileobj = self.r_service.fileno(), events = selectors.EVENT_READ)
|
||||||
selector.register(fileobj = self.w_service.fileno(), events = selectors.EVENT_WRITE)
|
|
||||||
|
|
||||||
while not self.__shutdown_request:
|
while not self.__shutdown_request:
|
||||||
ready = selector.select(timeout)
|
ready = selector.select(timeout)
|
||||||
@ -261,7 +260,7 @@ def server_options():
|
|||||||
# python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start --daemon_optionals
|
# python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start --daemon_optionals
|
||||||
|
|
||||||
kms_parser_check_optionals(userarg[0:pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile'])
|
kms_parser_check_optionals(userarg[0:pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile'])
|
||||||
kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0:pos])
|
kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0:pos], force_parse = True)
|
||||||
kms_parser_check_optionals(userarg[pos:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan')
|
kms_parser_check_optionals(userarg[pos:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan')
|
||||||
kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos:], msg = 'positional etrigan')
|
kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos:], msg = 'positional etrigan')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user