moonraker: refactor references to cmd_line_args
They are now named "system_args", as they represent system wide arguments. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
f96fb997da
commit
2e9c6de5d0
|
@ -129,7 +129,7 @@ class MoonrakerApp:
|
|||
self.get_handler_delegate = self.app.get_handler_delegate
|
||||
|
||||
# Register handlers
|
||||
logfile = config['cmd_args'].get('logfile')
|
||||
logfile = config['system_args'].get('logfile')
|
||||
self.register_static_file_handler("moonraker.log", logfile)
|
||||
self.auth.register_handlers(self)
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ class ConfigHelper:
|
|||
return self._get_item(
|
||||
self.config[self.section].getfloat, option, default)
|
||||
|
||||
def get_configuration(server, cmd_line_args):
|
||||
def get_configuration(server, system_args):
|
||||
cfg_file_path = os.path.normpath(os.path.expanduser(
|
||||
cmd_line_args.configfile))
|
||||
system_args.configfile))
|
||||
if not os.path.isfile(cfg_file_path):
|
||||
raise ConfigError(f"Configuration File Not Found: '{cfg_file_path}''")
|
||||
config = configparser.ConfigParser(interpolation=None)
|
||||
|
@ -89,5 +89,5 @@ def get_configuration(server, cmd_line_args):
|
|||
if server_cfg.get('enable_debug_logging', True):
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
config['cmd_args'] = {'logfile': cmd_line_args.logfile}
|
||||
config['system_args'] = {'logfile': system_args.logfile}
|
||||
return ConfigHelper(server, config, 'server')
|
||||
|
|
|
@ -101,7 +101,7 @@ class Server:
|
|||
|
||||
# check for optional plugins
|
||||
opt_sections = set([s.split()[0] for s in config.sections()]) - \
|
||||
set(['server', 'authorization', 'cmd_args'])
|
||||
set(['server', 'authorization', 'system_args'])
|
||||
for section in opt_sections:
|
||||
self.load_plugin(config, section, None)
|
||||
|
||||
|
@ -550,11 +550,11 @@ def main():
|
|||
parser.add_argument(
|
||||
"-l", "--logfile", default="/tmp/moonraker.log", metavar='<logfile>',
|
||||
help="log file name and location")
|
||||
cmd_line_args = parser.parse_args()
|
||||
system_args = parser.parse_args()
|
||||
|
||||
# Setup Logging
|
||||
log_file = os.path.normpath(os.path.expanduser(cmd_line_args.logfile))
|
||||
cmd_line_args.logfile = log_file
|
||||
log_file = os.path.normpath(os.path.expanduser(system_args.logfile))
|
||||
system_args.logfile = log_file
|
||||
ql = utils.setup_logging(log_file)
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
|
@ -570,7 +570,7 @@ def main():
|
|||
estatus = 0
|
||||
while True:
|
||||
try:
|
||||
server = Server(cmd_line_args)
|
||||
server = Server(system_args)
|
||||
except Exception:
|
||||
logging.exception("Moonraker Error")
|
||||
estatus = 1
|
||||
|
|
Loading…
Reference in New Issue