Update oci manager

This commit is contained in:
MacRimi
2026-03-15 17:59:47 +01:00
parent 0b75e967f3
commit af61d145da
4 changed files with 11 additions and 8 deletions

View File

@@ -98,6 +98,7 @@ cp "$SCRIPT_DIR/notification_events.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo
cp "$SCRIPT_DIR/flask_notification_routes.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ flask_notification_routes.py not found" cp "$SCRIPT_DIR/flask_notification_routes.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ flask_notification_routes.py not found"
cp "$SCRIPT_DIR/oci_manager.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ oci_manager.py not found" cp "$SCRIPT_DIR/oci_manager.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ oci_manager.py not found"
cp "$SCRIPT_DIR/flask_oci_routes.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ flask_oci_routes.py not found" cp "$SCRIPT_DIR/flask_oci_routes.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ flask_oci_routes.py not found"
cp "$SCRIPT_DIR/oci/description_templates.py" "$APP_DIR/usr/bin/" 2>/dev/null || echo "⚠️ description_templates.py not found"
echo "📋 Adding translation support..." echo "📋 Adding translation support..."
cat > "$APP_DIR/usr/bin/translate_cli.py" << 'PYEOF' cat > "$APP_DIR/usr/bin/translate_cli.py" << 'PYEOF'

View File

@@ -1177,8 +1177,9 @@ class HealthMonitor:
existing['status'] = 'CRITICAL' existing['status'] = 'CRITICAL'
# Append detail if different # Append detail if different
new_detail = val.get('reason', '') new_detail = val.get('reason', '')
if new_detail and new_detail not in existing.get('detail', ''): existing_detail = existing.get('detail', '')
existing['detail'] = f"{existing['detail']}; {new_detail}".strip('; ') if new_detail and new_detail not in existing_detail:
existing['detail'] = f"{existing_detail}; {new_detail}".strip('; ')
continue # Don't add raw disk error entry, we'll add consolidated later continue # Don't add raw disk error entry, we'll add consolidated later
# Non-disk entries go directly to checks # Non-disk entries go directly to checks
@@ -1306,25 +1307,26 @@ class HealthMonitor:
model = disk_info.get('model', '') model = disk_info.get('model', '')
# Get worst_health from persistence # Get worst_health from persistence
current_status = error_info.get('status', 'WARNING')
try: try:
health_status = health_persistence.get_disk_health_status(device_name, serial if serial else None) health_status = health_persistence.get_disk_health_status(device_name, serial if serial else None)
worst_health = health_status.get('worst_health', 'healthy') worst_health = health_status.get('worst_health', 'healthy')
# Final health = max(current, worst) # Final health = max(current, worst)
health_order = {'healthy': 0, 'ok': 0, 'warning': 1, 'critical': 2} health_order = {'healthy': 0, 'ok': 0, 'warning': 1, 'critical': 2}
current_level = health_order.get(error_info['status'].lower(), 1) current_level = health_order.get(current_status.lower(), 1)
worst_level = health_order.get(worst_health.lower(), 0) worst_level = health_order.get(worst_health.lower(), 0)
if worst_level > current_level: if worst_level > current_level:
# worst_health is worse, use it # worst_health is worse, use it
final_status = worst_health.upper() final_status = worst_health.upper()
else: else:
final_status = error_info['status'] final_status = current_status
except Exception: except Exception:
final_status = error_info['status'] final_status = current_status
# Build detail string with serial/model if available # Build detail string with serial/model if available
detail = error_info['detail'] detail = error_info.get('detail', error_info.get('reason', 'Unknown error'))
if serial and serial not in detail: if serial and serial not in detail:
detail = f"{serial} - {detail}" detail = f"{serial} - {detail}"

View File

@@ -190,7 +190,7 @@ def generate_vm_description(
</td> </td>
<td style='vertical-align: middle;'> <td style='vertical-align: middle;'>
<h1 style='margin: 0;'>{vm_name}</h1> <h1 style='margin: 0;'>{vm_name}</h1>
<p style='margin: 0;'>Created with ProxMenuX</p> <p style='margin: 0;'>Created with ProxMenux</p>
{version_html} {version_html}
</td> </td>
</tr> </tr>

View File

@@ -925,7 +925,7 @@ def _generate_html_description(app_def: Dict, container_def: Dict, hostname: str
</td> </td>
<td style='vertical-align: middle;'> <td style='vertical-align: middle;'>
<h1 style='margin: 0;'>{app_name}</h1> <h1 style='margin: 0;'>{app_name}</h1>
<p style='margin: 0;'>Created with ProxMenuX</p> <p style='margin: 0;'>Created with ProxMenux</p>
</td> </td>
</tr> </tr>
</table> </table>