mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
plinth: remove diagnose command
[fioddor: squash fixing commit] Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com> Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
This commit is contained in:
parent
d49d7f9b41
commit
4109d087bf
@ -2,7 +2,6 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import importlib
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -36,8 +35,6 @@ def parse_arguments():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--setup-no-install', default=False, nargs='*',
|
'--setup-no-install', default=False, nargs='*',
|
||||||
help='run setup tasks without installing packages and exit')
|
help='run setup tasks without installing packages and exit')
|
||||||
parser.add_argument('--diagnose', action='store_true', default=False,
|
|
||||||
help='run diagnostic tests and exit')
|
|
||||||
parser.add_argument('--list-dependencies', default=False, nargs='*',
|
parser.add_argument('--list-dependencies', default=False, nargs='*',
|
||||||
help='list package dependencies for essential modules')
|
help='list package dependencies for essential modules')
|
||||||
parser.add_argument('--list-modules', default=False, nargs='*',
|
parser.add_argument('--list-modules', default=False, nargs='*',
|
||||||
@ -84,26 +81,6 @@ def list_modules(modules_type):
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def run_diagnostics_and_exit():
|
|
||||||
"""Run diagostics on all modules and exit."""
|
|
||||||
module = importlib.import_module('plinth.modules.diagnostics.diagnostics')
|
|
||||||
error_code = 0
|
|
||||||
try:
|
|
||||||
module.run_on_all_modules()
|
|
||||||
except Exception as exception:
|
|
||||||
logger.exception('Error running diagnostics - %s', exception)
|
|
||||||
error_code = 2
|
|
||||||
|
|
||||||
for module, results in module.current_results['results'].items():
|
|
||||||
for test, result_value in results:
|
|
||||||
print('{result_value}: {module}: {test}'.format(
|
|
||||||
result_value=result_value, test=test, module=module))
|
|
||||||
if result_value != 'passed':
|
|
||||||
error_code = 1
|
|
||||||
|
|
||||||
sys.exit(error_code)
|
|
||||||
|
|
||||||
|
|
||||||
def adapt_config(arguments):
|
def adapt_config(arguments):
|
||||||
"""Give commandline arguments precedence over config entries"""
|
"""Give commandline arguments precedence over config entries"""
|
||||||
for argument_name in precedence_commandline_arguments:
|
for argument_name in precedence_commandline_arguments:
|
||||||
@ -160,9 +137,6 @@ def main():
|
|||||||
if arguments.list_modules is not False:
|
if arguments.list_modules is not False:
|
||||||
list_modules(arguments.list_modules)
|
list_modules(arguments.list_modules)
|
||||||
|
|
||||||
if arguments.diagnose:
|
|
||||||
run_diagnostics_and_exit()
|
|
||||||
|
|
||||||
setup.run_setup_in_background()
|
setup.run_setup_in_background()
|
||||||
|
|
||||||
glib.run()
|
glib.run()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user