js-api 0.3.0__tar.gz → 0.3.1__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.
- {js_api-0.3.0 → js_api-0.3.1}/PKG-INFO +1 -1
- {js_api-0.3.0 → js_api-0.3.1}/pyproject.toml +1 -1
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/webhook.py +21 -2
- {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/PKG-INFO +1 -1
- {js_api-0.3.0 → js_api-0.3.1}/LICENSE +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/README.md +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/setup.cfg +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/__init__.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/api.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/__init__.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/docker.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/health_check.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/ip.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/controllers/valentines_day.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/database.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/SOURCES.txt +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/dependency_links.txt +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/requires.txt +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/js_api.egg-info/top_level.txt +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/models.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/__init__.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/auth.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/docker.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/healthcheck.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/logging.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/src/util/mail.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/tests/test_docker.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/tests/test_health_check.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/tests/test_ip.py +0 -0
- {js_api-0.3.0 → js_api-0.3.1}/tests/test_webhook.py +0 -0
|
@@ -96,14 +96,33 @@ async def pve_ups(webhook: PveUpsWebhook):
|
|
|
96
96
|
sender_addr="PVE UPS <no-reply@jstockley.com>",
|
|
97
97
|
template="pve_ups_email.html",
|
|
98
98
|
subject=webhook.subject,
|
|
99
|
-
to=webhook.to,
|
|
99
|
+
to=[webhook.to],
|
|
100
100
|
context={
|
|
101
101
|
"body": webhook.body,
|
|
102
102
|
"subject": webhook.subject,
|
|
103
|
-
"facts": webhook.facts,
|
|
103
|
+
"facts": parse_facts(webhook.facts),
|
|
104
104
|
"timestamp": webhook.timestamp,
|
|
105
105
|
"severity": webhook.severity,
|
|
106
106
|
"severity_upper": webhook.severity.upper(),
|
|
107
107
|
"version": webhook.version,
|
|
108
108
|
},
|
|
109
109
|
)
|
|
110
|
+
|
|
111
|
+
return {"status": "sent"}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def parse_facts(facts_text: str) -> list[dict]:
|
|
115
|
+
"""Turn PVE-UPS's rendered 'facts' string into {label, value} rows."""
|
|
116
|
+
facts = []
|
|
117
|
+
for line in facts_text.splitlines():
|
|
118
|
+
line = line.strip()
|
|
119
|
+
if not line:
|
|
120
|
+
continue
|
|
121
|
+
if ":" in line:
|
|
122
|
+
label, _, value = line.partition(":")
|
|
123
|
+
facts.append({"label": label.strip(), "value": value.strip()})
|
|
124
|
+
else:
|
|
125
|
+
facts.append(
|
|
126
|
+
{"label": "", "value": line}
|
|
127
|
+
) # no colon: show it anyway, don't drop it
|
|
128
|
+
return facts
|
|
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
|