Directory structure and filename refactoring. (0.20.5)

This commit is contained in:
Johannes Findeisen 2023-02-23 10:26:44 +01:00
commit 0c2c0917b2
53 changed files with 177 additions and 90 deletions

90
.editorconfig Normal file
View file

@ -0,0 +1,90 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[{*.py,*.pyw}]
max_line_length = 100
ij_python_align_collections_and_comprehensions = true
ij_python_align_multiline_imports = true
ij_python_align_multiline_parameters = true
ij_python_align_multiline_parameters_in_calls = true
ij_python_blank_line_at_file_end = true
ij_python_blank_lines_after_imports = 1
ij_python_blank_lines_after_local_imports = 0
ij_python_blank_lines_around_class = 1
ij_python_blank_lines_around_method = 1
ij_python_blank_lines_around_top_level_classes_functions = 2
ij_python_blank_lines_before_first_method = 0
ij_python_call_parameters_new_line_after_left_paren = false
ij_python_call_parameters_right_paren_on_new_line = false
ij_python_call_parameters_wrap = normal
ij_python_dict_alignment = 0
ij_python_dict_new_line_after_left_brace = false
ij_python_dict_new_line_before_right_brace = false
ij_python_dict_wrapping = 1
ij_python_from_import_new_line_after_left_parenthesis = false
ij_python_from_import_new_line_before_right_parenthesis = false
ij_python_from_import_parentheses_force_if_multiline = false
ij_python_from_import_trailing_comma_if_multiline = false
ij_python_from_import_wrapping = 1
ij_python_hang_closing_brackets = false
ij_python_keep_blank_lines_in_code = 1
ij_python_keep_blank_lines_in_declarations = 1
ij_python_keep_indents_on_empty_lines = false
ij_python_keep_line_breaks = true
ij_python_method_parameters_new_line_after_left_paren = false
ij_python_method_parameters_right_paren_on_new_line = false
ij_python_method_parameters_wrap = normal
ij_python_new_line_after_colon = false
ij_python_new_line_after_colon_multi_clause = true
ij_python_optimize_imports_always_split_from_imports = false
ij_python_optimize_imports_case_insensitive_order = false
ij_python_optimize_imports_join_from_imports_with_same_source = false
ij_python_optimize_imports_sort_by_type_first = true
ij_python_optimize_imports_sort_imports = true
ij_python_optimize_imports_sort_names_in_from_imports = false
ij_python_space_after_comma = true
ij_python_space_after_number_sign = true
ij_python_space_after_py_colon = true
ij_python_space_before_backslash = true
ij_python_space_before_comma = false
ij_python_space_before_for_semicolon = false
ij_python_space_before_lbracket = false
ij_python_space_before_method_call_parentheses = false
ij_python_space_before_method_parentheses = false
ij_python_space_before_number_sign = true
ij_python_space_before_py_colon = false
ij_python_space_within_empty_method_call_parentheses = false
ij_python_space_within_empty_method_parentheses = false
ij_python_spaces_around_additive_operators = true
ij_python_spaces_around_assignment_operators = true
ij_python_spaces_around_bitwise_operators = true
ij_python_spaces_around_eq_in_keyword_argument = false
ij_python_spaces_around_eq_in_named_parameter = false
ij_python_spaces_around_equality_operators = true
ij_python_spaces_around_multiplicative_operators = true
ij_python_spaces_around_power_operator = true
ij_python_spaces_around_relational_operators = true
ij_python_spaces_around_shift_operators = true
ij_python_spaces_within_braces = false
ij_python_spaces_within_brackets = false
ij_python_spaces_within_method_call_parentheses = false
ij_python_spaces_within_method_parentheses = false
ij_python_use_continuation_indent_for_arguments = false
ij_python_use_continuation_indent_for_collection_and_comprehensions = false
ij_python_use_continuation_indent_for_parameters = true
ij_python_wrap_long_lines = false

View file

@ -38,4 +38,3 @@ run:
daemon:
PYTHONPATH=$(shell pwd):$(shell pwd)/venv/lib/python$(PYTHON_VRESION)/site-packages/ bin/linspector -d ./etc

View file

View file

@ -2,7 +2,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
# TODO: VERY IMPORTANT! IMPLEMENT ERROR HANDLING ALL THE WAY...!!!
# Only exit execution on critical core errors. Do not exit when monitors are failing on
@ -11,13 +11,13 @@ import argparse
import signal
import sys
from linspector.core.configuration import Configuration
from linspector.core.environment import Environment
from linspector.core.linspector import Linspector
from linspector.core.logger import Log
from linspector.core.monitors import Monitors
from linspector.configuration import Configuration
from linspector.environment import Environment
from linspector.linspector import Linspector
from linspector.logger import Log
from linspector.monitors import Monitors
__version__ = '0.20.4'
__version__ = '0.20.5'
__author__ = 'Johannes Findeisen <you@hanez.org>'
@ -85,7 +85,7 @@ def main():
# daemon initialization
if args.daemon:
try:
from linspector.core.linspectord import Linspectord
from linspector.linspectord import Linspectord
linspectord = Linspectord(configuration, environment, linspector, log)
# do handling of restart, start and stop commands but for now "start" is enough... ;)
if args.kill:

View file

@ -2,7 +2,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
# TODO: Make use of the "rich" library to for rich text and beautiful formatting in the terminal.
import argparse
@ -14,11 +14,10 @@ import logging.handlers
import os
import sys
from linspector.core.configuration import Configuration
from linspector.core.environment import Environment
from linspector.core.linspector import Linspector
from linspector.core.logger import Log
from linspector.core.monitors import Monitors
from linspector.configuration import Configuration
from linspector.environment import Environment
from linspector.linspector import Linspector
from linspector.monitors import Monitors
logger = logging.getLogger('linspector')
@ -146,7 +145,7 @@ def main():
# daemon initialization
if args.daemon:
try:
from linspector.core.linspectord import Linspectord
from linspector.linspectord import Linspectord
linspectord = Linspectord(configuration, environment, linspector, log)
# do handling of restart, start and stop commands but for now "start" is enough... ;)
if args.kill:

View file

@ -2,7 +2,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2023 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt for more details.
See LICENSE for more details.
"""
# TODO: Make this a curses style TUI interface for Linspector using urwid or maybe some more modern
# framework like textual. Look at the Lish code for more details about backend implementation and

View file

@ -56,7 +56,7 @@ timezone = CET
; development only.
delta_range = 60
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO.txt for more
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO for more
; information.
[hostgroupparents]
; hostgroup group1 is parent of group2

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import configparser
import glob

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -2,7 +2,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import datetime
import importlib

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import atexit
import os

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import logging
import os

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import configparser
import importlib

View file

@ -1,13 +1,13 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import configparser
import glob
import os
from linspector.core.monitor import Monitor
from linspector.monitor import Monitor
# monitors may must / should be added (and maybe changed) at runtime to add new monitors without

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.notification import Notification
from linspector.notification import Notification
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.notification import Notification
from linspector.notification import Notification
def create(configuration, environment, log):

View file

@ -1,10 +1,10 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.notification import Notification
from linspector.notification import Notification
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.notification import Notification
from linspector.notification import Notification
def create(configuration, environment, log):

View file

@ -1,10 +1,10 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.notification import Notification
from linspector.notification import Notification
def create(configuration, environment, log):

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -1,13 +1,12 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2023 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
# TODO: Make this a backend API using the modern FastAPI framework as a replacement for the
# traditional RPC plugin. Maybe it makes sense to maintain the RPC plugin too for simple usage by
# the Lish but I believe it makes sense to only create one backend for all clients.
from fastapi import FastAPI
from linspector.core.plugin import Plugin
from linspector.plugin import Plugin
def create(configuration, environment, linspector, log):

View file

@ -1,13 +1,13 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import json
import cherrypy
from linspector.core.plugin import Plugin
from linspector.plugin import Plugin
def create(configuration, environment, linspector, log):

View file

@ -1,12 +1,12 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
# TODO: This plugin should become the internal Lish implemented as a plugin which does not use the
# API plugin but loads at the end when starting Linspector in interactive mode as a terminal like
# interface to the core of Linspector.
from linspector.core.plugin import Plugin
from linspector.plugin import Plugin
def create(configuration, environment, linspector, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.plugin import Plugin
from linspector.plugin import Plugin
def create(configuration, environment, linspector, log):

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,11 +1,11 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import socket
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,14 +1,14 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import calendar
import time
import requests
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,14 +1,14 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
import os
import pprint
import paramiko
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,10 +1,10 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -3,7 +3,7 @@ This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE (MIT license)
"""
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -3,7 +3,7 @@ This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE (MIT license)
"""
from linspector.core.service import Service
from linspector.service import Service
def get(configuration, environment, log):

View file

@ -1,11 +1,11 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from fritzconnection.lib.fritzstatus import FritzStatus
from linspector.core.service import Service
from linspector.service import Service
def create(configuration, environment, log):

View file

@ -1,7 +1,7 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""

View file

@ -1,12 +1,12 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from queue import Queue
from threading import Thread
from linspector.core.singleton import Singleton
from linspector.singleton import Singleton
KEY_TYPE = "type"
KEY_ARGS = "args"

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2023 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):

View file

@ -1,9 +1,9 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2023 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
See LICENSE (MIT license).
"""
from linspector.core.task import Task
from linspector.task import Task
def create(configuration, environment, log):