(refactor) Remove pobsync_home from global config
Drop the obsolete pobsync_home field from GlobalConfig and remove it from runtime config generation, form saves, and configuration commands. The runtime state root now comes exclusively from POBSYNC_HOME/settings, which keeps the Django model focused on backup behavior instead of install layout.
This commit is contained in:
@@ -11,7 +11,6 @@ class ConfigRepositoryTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/var/lib/pobsync",
|
||||
ssh_user="backup",
|
||||
ssh_port=2222,
|
||||
rsync_args=["--archive"],
|
||||
@@ -22,7 +21,6 @@ class ConfigRepositoryTests(TestCase):
|
||||
retention_yearly=1,
|
||||
data={
|
||||
"backup_root": "/ignored",
|
||||
"pobsync_home": "/ignored",
|
||||
"ssh": {"user": "ignored", "port": 22, "options": []},
|
||||
"unknown": "must-not-leak",
|
||||
"retention_defaults": {"daily": 99, "weekly": 99, "monthly": 99, "yearly": 99},
|
||||
@@ -51,7 +49,6 @@ class ConfigRepositoryTests(TestCase):
|
||||
host_cfg = host_config_data("web-01")
|
||||
|
||||
self.assertEqual(global_cfg["backup_root"], "/backups")
|
||||
self.assertEqual(global_cfg["pobsync_home"], "/var/lib/pobsync")
|
||||
self.assertEqual(global_cfg["ssh"]["user"], "backup")
|
||||
self.assertEqual(global_cfg["ssh"]["port"], 2222)
|
||||
self.assertEqual(global_cfg["retention_defaults"]["daily"], 7)
|
||||
|
||||
@@ -16,7 +16,6 @@ class ConfigureCommandsTests(TestCase):
|
||||
call_command(
|
||||
"configure_pobsync_global",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
retention="daily=3,weekly=2,monthly=1,yearly=0",
|
||||
stdout=out,
|
||||
)
|
||||
|
||||
@@ -15,7 +15,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
rsync_args=["--archive"],
|
||||
rsync_extra_args=["--numeric-ids"],
|
||||
excludes_default=["/proc/***"],
|
||||
@@ -25,7 +24,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
retention_yearly=1,
|
||||
data={
|
||||
"backup_root": "/ignored",
|
||||
"pobsync_home": "/ignored",
|
||||
"ssh": {"user": "root", "port": 22, "options": []},
|
||||
"rsync": {
|
||||
"binary": "rsync",
|
||||
@@ -72,7 +70,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
default_ssh_credential=credential,
|
||||
ssh_options=["-oBatchMode=yes"],
|
||||
)
|
||||
@@ -99,7 +96,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
default_ssh_credential=global_credential,
|
||||
)
|
||||
HostConfig.objects.create(
|
||||
@@ -127,7 +123,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
default_ssh_credential=credential,
|
||||
)
|
||||
HostConfig.objects.create(host="web-01", address="web-01.example.test")
|
||||
@@ -146,7 +141,6 @@ class DjangoConfigSourceTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/backups",
|
||||
pobsync_home="/opt/pobsync",
|
||||
default_ssh_credential=credential,
|
||||
)
|
||||
HostConfig.objects.create(host="web-01", address="web-01.example.test")
|
||||
|
||||
@@ -475,7 +475,6 @@ class ViewTests(TestCase):
|
||||
self.assertContains(response, "Global config saved for default.")
|
||||
config = GlobalConfig.objects.get(name="default")
|
||||
self.assertEqual(config.backup_root, "/backups")
|
||||
self.assertEqual(config.pobsync_home, "/opt/pobsync")
|
||||
self.assertEqual(config.default_ssh_credential, credential)
|
||||
self.assertEqual(config.ssh_user, "backup")
|
||||
self.assertEqual(config.ssh_port, 2222)
|
||||
@@ -502,7 +501,6 @@ class ViewTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/mnt/pobsync/backups",
|
||||
pobsync_home="/custom/state/home",
|
||||
)
|
||||
|
||||
response = self.client.get(reverse("edit_global_config"))
|
||||
@@ -532,7 +530,6 @@ class ViewTests(TestCase):
|
||||
GlobalConfig.objects.create(
|
||||
name="default",
|
||||
backup_root="/mnt/pobsync/backups",
|
||||
pobsync_home="/custom/state/home",
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
@@ -561,7 +558,6 @@ class ViewTests(TestCase):
|
||||
self.assertRedirects(response, reverse("dashboard"))
|
||||
config = GlobalConfig.objects.get(name="default")
|
||||
self.assertEqual(config.backup_root, "/backups")
|
||||
self.assertEqual(config.pobsync_home, "/opt/pobsync")
|
||||
|
||||
def test_create_host_config_form_creates_host(self) -> None:
|
||||
self.client.force_login(self.staff_user)
|
||||
|
||||
Reference in New Issue
Block a user