Auto-commit local changes before build (2026-03-20 12:02:04)

This commit is contained in:
Ivo Oskamp 2026-03-20 12:02:04 +01:00
parent 6dfbab3354
commit 22a12348cb
2 changed files with 55 additions and 0 deletions

View File

@ -735,6 +735,12 @@ def _ensure_missed_runs_for_job(job: Job, start_from: date, end_inclusive: date)
Returns number of inserted missed runs. Returns number of inserted missed runs.
""" """
# Cloud Connect jobs get one run per day whenever Veeam sends the report — the
# delivery time can shift (e.g. from 18:55 to 10:24) without indicating a missed run.
# Schedule inference would wrongly produce two expected slots, so skip entirely.
if getattr(job, "backup_type", "").lower() in ("cloud connect backup", "cloud connect agent"):
return 0
tz = _get_ui_timezone() tz = _get_ui_timezone()
schedule_map = _infer_schedule_map_from_runs(job.id) or {} schedule_map = _infer_schedule_map_from_runs(job.id) or {}
has_weekly_times = any((schedule_map.get(i) or []) for i in range(7)) has_weekly_times = any((schedule_map.get(i) or []) for i in range(7))

View File

@ -285,6 +285,55 @@ Settings → Integrations → Cove section:
--- ---
## Veeam Cloud Connect Integration
### Overview
Veeam Cloud Connect sends a daily HTML report email (one email per provider, covering all tenants). The importer parses the HTML table and upserts each tenant row into the `cloud_connect_accounts` staging table. Linked accounts create `JobRun` records; unlinked accounts appear on the Cloud Connect Accounts review page.
### Files
- `app/cloud_connect_importer.py` — HTML parser + upsert logic
- `app/main/routes_cloud_connect.py``/cloud-connect/accounts` page, link/unlink/scan-inbox routes
- `templates/main/cloud_connect_accounts.html` — accounts review page
### Email Structure
- One email covers all tenants (unlike Cove, which sends one email per account)
- Sections: `Backup`, `Replication`, `Agent` (detected from `<p>` tags with `font-size: 18px`)
- Each section has a table with columns: User, #VM / #WS+#Server (Agent), Repo Name, Repository, Total quota, Used space, Free space, Last active, Expiry
### Status Mapping (row background colour)
| Colour | Status |
|--------|--------|
| `#fb9895` / `#ff9999` / `#f4cccc` / `#ffb3b3` | Failed |
| `#ffd96c` / `#fff2cc` / `#ffe599` / `#f9cb9c` | Warning |
| white / no background | Success |
**⚠ TODO — Last active detection logic**: The importer currently trusts Veeam's row colour as the sole status indicator (white = Success). An earlier version downgraded white rows to Warning when "Last active" exceeded 3 days, but this was removed because Veeam itself determines row colour. It is still an open question whether backupchecks should apply its own independent "last active" threshold on top of Veeam's colour — e.g. to catch cases where Veeam shows a white row for a backup that hasn't run in a long time. **Needs review before production use.**
### Staging Table: `cloud_connect_accounts`
Unique key: `(user, section, repo_name)` — one row per tenant × section × repository.
A single user can have multiple repositories (e.g. a standard repo + an immutable repo), each stored as a separate account row and each linkable to a separate Backupchecks job.
### Deduplication
`external_id = f"vcc-{user}-{section}-{repo_slug}-{report_date}"` — one `JobRun` per job per repository per report date. Re-importing the same email updates the run status and refreshes `run_object_links`.
### Run Enrichment
- `source_type = "cloud_connect"` on every `JobRun` created by the importer
- `_persist_cc_objects()` upserts the repository as a `customer_object` (type `cloud_connect_repo`) and links it via `run_object_links` — mirrors the Cove datasource pattern and enables per-run reporting
- The `run_at` is set to the mail's `received_at` (not today) so historical re-imports land on the correct date
### Job Detail Popup (job_detail.html)
For CC runs the popup shows a structured Cloud Connect summary panel (User/Section/Repository/Used/Quota/Free/Last active/Status) instead of the raw report email. The report email is still accessible via a collapsible "Source report email" toggle. Only the single per-run repository object is shown (from `run_object_links`), not all tenants from the shared mail.
### Scan Inbox
`POST /cloud-connect/accounts/scan-inbox` — re-processes all stored CC report emails (location ≠ deleted). Safe to run multiple times; deduplication prevents duplicate runs.
### Migrations
- `migrate_cloud_connect_accounts_table()` — creates `cloud_connect_accounts` table with `(user, section)` unique key
- `migrate_cc_accounts_repo_unique_key()` — extends unique key to `(user, section, repo_name)`, makes `repo_name` NOT NULL DEFAULT `''`
---
## Ticketing and Autotask (Critical Rules) ## Ticketing and Autotask (Critical Rules)
### Two Ticket Types ### Two Ticket Types