(refactor) Remove unused schedule user field

Drop the legacy schedule user setting from the Django model, form, defaults,
and configure command.

Schedules are executed by the pobsync scheduler service under the configured
systemd service user, while remote SSH login users are configured separately
on global or host backup config.

Add a migration to remove the unused database column and update schedule
view tests around the simplified form.
This commit is contained in:
2026-05-19 23:41:55 +02:00
parent 5ca2733ea9
commit c2d7342a47
6 changed files with 15 additions and 11 deletions

View File

@@ -1162,7 +1162,6 @@ class ViewTests(TestCase):
reverse("edit_host_schedule", args=[host.host]),
{
"cron_expr": "30 3 * * *",
"user": "root",
"enabled": "on",
"prune": "on",
"prune_max_delete": "4",
@@ -1189,7 +1188,6 @@ class ViewTests(TestCase):
reverse("edit_host_schedule", args=[host.host]),
{
"cron_expr": "45 4 * * 1",
"user": "backup",
"prune_max_delete": "8",
},
follow=True,
@@ -1198,7 +1196,6 @@ class ViewTests(TestCase):
self.assertRedirects(response, reverse("host_detail", args=[host.host]))
schedule.refresh_from_db()
self.assertEqual(schedule.cron_expr, "45 4 * * 1")
self.assertEqual(schedule.user, "backup")
self.assertFalse(schedule.enabled)
self.assertFalse(schedule.prune)
self.assertEqual(schedule.prune_max_delete, 8)
@@ -1209,7 +1206,6 @@ class ViewTests(TestCase):
ScheduleConfig.objects.create(
host=host,
cron_expr="45 4 * * 1",
user="backup",
enabled=True,
prune_max_delete=8,
)
@@ -1219,9 +1215,9 @@ class ViewTests(TestCase):
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Edit Schedule")
self.assertContains(response, 'value="45 4 * * 1"', html=False)
self.assertContains(response, 'value="backup"', html=False)
self.assertContains(response, 'value="8"', html=False)
self.assertNotContains(response, 'value="15 2 * * *"', html=False)
self.assertNotContains(response, ">User<", html=False)
def test_schedule_form_rejects_invalid_cron(self) -> None:
self.client.force_login(self.staff_user)
@@ -1231,7 +1227,6 @@ class ViewTests(TestCase):
reverse("edit_host_schedule", args=[host.host]),
{
"cron_expr": "bad cron",
"user": "root",
"enabled": "on",
"prune_max_delete": "10",
},