mirror of
https://github.com/SystemRage/py-kms.git
synced 2024-11-25 17:55:37 +01:00
enabled -c None (and -t0 None) parsing syntax #75
This commit is contained in:
parent
d5fa609de5
commit
8754ebe965
@ -195,7 +195,7 @@ def server_options():
|
|||||||
server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'],
|
server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'],
|
||||||
help = srv_options['lcid']['help'], type = int)
|
help = srv_options['lcid']['help'], type = int)
|
||||||
server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'],
|
server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'],
|
||||||
help = srv_options['count']['help'], type = int)
|
help = srv_options['count']['help'], type = str)
|
||||||
server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'],
|
server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'],
|
||||||
default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int)
|
default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int)
|
||||||
server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'],
|
server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'],
|
||||||
@ -205,7 +205,7 @@ def server_options():
|
|||||||
server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'],
|
server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'],
|
||||||
help = srv_options['hwid']['help'], type = str)
|
help = srv_options['hwid']['help'], type = str)
|
||||||
server_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = srv_options['time0']['des'], default = srv_options['time0']['def'],
|
server_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = srv_options['time0']['des'], default = srv_options['time0']['def'],
|
||||||
help = srv_options['time0']['help'], type = int)
|
help = srv_options['time0']['help'], type = str)
|
||||||
server_parser.add_argument("-y", "--async-msg", action = "store_true", dest = srv_options['asyncmsg']['des'],
|
server_parser.add_argument("-y", "--async-msg", action = "store_true", dest = srv_options['asyncmsg']['des'],
|
||||||
default = srv_options['asyncmsg']['def'], help = srv_options['asyncmsg']['help'])
|
default = srv_options['asyncmsg']['def'], help = srv_options['asyncmsg']['help'])
|
||||||
server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'],
|
server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'],
|
||||||
@ -394,10 +394,12 @@ def server_check():
|
|||||||
list_opt += ['-a/--activation-interval', '-r/--renewal-interval']
|
list_opt += ['-a/--activation-interval', '-r/--renewal-interval']
|
||||||
|
|
||||||
for dest, opt in zip(list_dest, list_opt):
|
for dest, opt in zip(list_dest, list_opt):
|
||||||
value = srv_config[dest]
|
try:
|
||||||
if (value is not None) and (not isinstance(value, int)):
|
srv_config[dest] = int(srv_config[dest])
|
||||||
pretty_printer(log_obj = loggersrv.error, to_exit = True,
|
except:
|
||||||
put_text = "{reverse}{red}{bold}argument `%s`: invalid with: '%s'. Exiting...{end}" %(opt, value))
|
if srv_config[dest] is not None:
|
||||||
|
pretty_printer(log_obj = loggersrv.error, to_exit = True,
|
||||||
|
put_text = "{reverse}{red}{bold}argument `%s`: invalid with: '%s'. Exiting...{end}" %(opt, srv_config[dest]))
|
||||||
|
|
||||||
def server_create():
|
def server_create():
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user