sysnet-pyutils 1.7.7__tar.gz → 1.7.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/PKG-INFO +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/pyproject.toml +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/__init__.py +4 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/models/general.py +15 -16
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/PKG-INFO +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_models_general.py +12 -8
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/LICENSE +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/README.md +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/setup.cfg +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/barcode.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/constants.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/cron_utils/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/cron_utils/validation.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/data_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/domino.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/geo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/globalmodel/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/globalmodel/global_model.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/globalmodel/models.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/globalmodel/timeutils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/ident.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/log.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/models/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/ses.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/syslog/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/syslog/factory.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/tools.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils/utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/SOURCES.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/dependency_links.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/not-zip-safe +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/requires.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/sysnet_pyutils.egg-info/top_level.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_cron_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_cron_validation_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_data_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_data_utils_datetime.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_data_utils_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_data_utils_missing_branches.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_domino.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_domino_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_geo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_global_model_recursive.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_global_model_timezone.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_ident_barcode.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_log_importerror_branch.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_log_mongo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_models_contact.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_models_general_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_package_init_version.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_recursive_update.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_ses.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_ses_importerror_branch.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_syslog_factory.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_tools.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_utils_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_utils_log_base64.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.8}/tests/test_utils_missing_branches.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sysnet-pyutils
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.8
|
|
4
4
|
Summary: SYSNET Python Utilities - kompletní sada nástrojů pro Python aplikace
|
|
5
5
|
Author-email: Data Developer <info@sysnet.cz>
|
|
6
6
|
Maintainer-email: SYSNET Development Team <info@sysnet.cz>
|
|
@@ -93,6 +93,9 @@ from sysnet_pyutils.models.general import (
|
|
|
93
93
|
ErrorModel,
|
|
94
94
|
GeoPointJtskType,
|
|
95
95
|
GeoPointType,
|
|
96
|
+
InfoComponentType,
|
|
97
|
+
InfoStatusEnum,
|
|
98
|
+
InfoType,
|
|
96
99
|
LinkedType,
|
|
97
100
|
ListTypeBase,
|
|
98
101
|
LocationType,
|
|
@@ -111,6 +114,7 @@ from sysnet_pyutils.models.general import (
|
|
|
111
114
|
TimeLimitedType,
|
|
112
115
|
UserType,
|
|
113
116
|
WorkflowType,
|
|
117
|
+
calculate_status,
|
|
114
118
|
)
|
|
115
119
|
|
|
116
120
|
# Syslog
|
|
@@ -468,28 +468,27 @@ class InfoStatusEnum(BaseEnum):
|
|
|
468
468
|
RED = "RED"
|
|
469
469
|
|
|
470
470
|
|
|
471
|
+
def calculate_status(statuses: List[InfoStatusEnum]) -> InfoStatusEnum:
|
|
472
|
+
"""Vypočítá celkový stav na základě seznamu stavů (RED > YELLOW > GREEN)."""
|
|
473
|
+
if not statuses:
|
|
474
|
+
return InfoStatusEnum.GREEN
|
|
475
|
+
if InfoStatusEnum.RED in statuses:
|
|
476
|
+
return InfoStatusEnum.RED
|
|
477
|
+
if InfoStatusEnum.YELLOW in statuses:
|
|
478
|
+
return InfoStatusEnum.YELLOW
|
|
479
|
+
return InfoStatusEnum.GREEN
|
|
480
|
+
|
|
481
|
+
|
|
471
482
|
class InfoComponentType(BaseModel):
|
|
472
|
-
|
|
483
|
+
name: str = Field(..., description="Název komponenty (např. mongo-db, storage)")
|
|
473
484
|
status: InfoStatusEnum = Field(..., description="Stav komponenty")
|
|
474
|
-
|
|
485
|
+
message: Optional[str] = Field(default=None, description="Detailní zpráva o stavu")
|
|
475
486
|
|
|
476
487
|
|
|
477
488
|
class InfoType(BaseModel):
|
|
478
|
-
status: InfoStatusEnum = Field(default=InfoStatusEnum.GREEN, description="Celkový stav služby")
|
|
479
489
|
name: str = Field(..., description="Název služby")
|
|
480
490
|
version: str = Field(..., description="Verze služby")
|
|
491
|
+
status: InfoStatusEnum = Field(default=InfoStatusEnum.GREEN, description="Celkový stav služby")
|
|
492
|
+
timestamp: datetime = Field(default_factory=datetime.now, description="Čas vygenerování reportu")
|
|
481
493
|
components: List[InfoComponentType] = Field(default_factory=list, description="Seznam komponent")
|
|
482
494
|
|
|
483
|
-
def update_status(self):
|
|
484
|
-
"""Aktualizuje celkový status na základě nejhoršího stavu komponent."""
|
|
485
|
-
if not self.components:
|
|
486
|
-
self.status = InfoStatusEnum.GREEN
|
|
487
|
-
return self.status
|
|
488
|
-
statuses = [c.status for c in self.components]
|
|
489
|
-
if InfoStatusEnum.RED in statuses:
|
|
490
|
-
self.status = InfoStatusEnum.RED
|
|
491
|
-
elif InfoStatusEnum.YELLOW in statuses:
|
|
492
|
-
self.status = InfoStatusEnum.YELLOW
|
|
493
|
-
else:
|
|
494
|
-
self.status = InfoStatusEnum.GREEN
|
|
495
|
-
return self.status
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sysnet-pyutils
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.8
|
|
4
4
|
Summary: SYSNET Python Utilities - kompletní sada nástrojů pro Python aplikace
|
|
5
5
|
Author-email: Data Developer <info@sysnet.cz>
|
|
6
6
|
Maintainer-email: SYSNET Development Team <info@sysnet.cz>
|
|
@@ -208,20 +208,24 @@ class TestIntegration:
|
|
|
208
208
|
assert metadata.contributor.name == "Jan Novák"
|
|
209
209
|
|
|
210
210
|
def test_info_type_status_calculation():
|
|
211
|
-
from sysnet_pyutils.models.general import InfoType, InfoComponentType, InfoStatusEnum
|
|
211
|
+
from sysnet_pyutils.models.general import InfoType, InfoComponentType, InfoStatusEnum, calculate_status
|
|
212
212
|
|
|
213
213
|
info = InfoType(name="Test Service", version="1.0.0")
|
|
214
214
|
assert info.status == InfoStatusEnum.GREEN
|
|
215
215
|
|
|
216
|
-
info.components.append(InfoComponentType(
|
|
217
|
-
|
|
216
|
+
info.components.append(InfoComponentType(name="mongo", status=InfoStatusEnum.GREEN))
|
|
217
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
218
|
+
assert info.status == InfoStatusEnum.GREEN
|
|
218
219
|
|
|
219
|
-
info.components.append(InfoComponentType(
|
|
220
|
-
|
|
220
|
+
info.components.append(InfoComponentType(name="redis", status=InfoStatusEnum.YELLOW))
|
|
221
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
222
|
+
assert info.status == InfoStatusEnum.YELLOW
|
|
221
223
|
|
|
222
|
-
info.components.append(InfoComponentType(
|
|
223
|
-
|
|
224
|
+
info.components.append(InfoComponentType(name="storage", status=InfoStatusEnum.RED))
|
|
225
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
226
|
+
assert info.status == InfoStatusEnum.RED
|
|
224
227
|
|
|
225
228
|
# Odebrání RED komponenty by mělo vrátit YELLOW
|
|
226
229
|
info.components = [c for c in info.components if c.status != InfoStatusEnum.RED]
|
|
227
|
-
|
|
230
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
231
|
+
assert info.status == InfoStatusEnum.YELLOW
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|