Rename the new flag to custom_days

pull/136079/head
Erik 2025-01-20 13:49:20 +01:00
parent e7e94dfcba
commit ffac481493
3 changed files with 10 additions and 10 deletions

View File

@ -283,7 +283,7 @@ class ScheduleState(StrEnum):
NEVER = "never"
DAILY = "daily"
CUSTOM = "custom"
CUSTOM_DAYS = "custom_days"
MONDAY = "mon"
TUESDAY = "tue"
WEDNESDAY = "wed"
@ -313,7 +313,7 @@ class BackupSchedule:
There are only three possible state types: never, daily, or weekly.
"""
if self.state is ScheduleState.NEVER or (
self.state is ScheduleState.CUSTOM and not self.days
self.state is ScheduleState.CUSTOM_DAYS and not self.days
):
self._unschedule_next(manager)
return
@ -324,7 +324,7 @@ class BackupSchedule:
CRON_PATTERN_DAILY.format(m=time.minute, h=time.hour),
manager,
)
elif self.state is ScheduleState.CUSTOM:
elif self.state is ScheduleState.CUSTOM_DAYS:
self._schedule_next(
CRON_PATTERN_WEEKLY.format(
m=time.minute,

View File

@ -468,7 +468,7 @@
'mon',
'sun',
]),
'state': 'custom',
'state': 'custom_days',
'time': None,
}),
}),
@ -1169,7 +1169,7 @@
'mon',
'sun',
]),
'state': 'custom',
'state': 'custom_days',
'time': None,
}),
}),
@ -1206,7 +1206,7 @@
'mon',
'sun',
]),
'state': 'custom',
'state': 'custom_days',
'time': None,
}),
}),

View File

@ -1051,7 +1051,7 @@ async def test_agents_info(
"last_completed_automatic_backup": None,
"schedule": {
"days": ["mon", "sun"],
"state": "custom",
"state": "custom_days",
"time": None,
},
},
@ -1113,7 +1113,7 @@ async def test_config_info(
{
"type": "backup/config/update",
"create_backup": {"agent_ids": ["test-agent"]},
"schedule": {"days": ["mon", "sun"], "state": "custom"},
"schedule": {"days": ["mon", "sun"], "state": "custom_days"},
},
{
"type": "backup/config/update",
@ -1380,7 +1380,7 @@ async def test_config_update_errors(
{
"type": "backup/config/update",
"create_backup": {"agent_ids": ["test.test-agent"]},
"schedule": {"days": ["wed", "fri"], "state": "custom"},
"schedule": {"days": ["wed", "fri"], "state": "custom_days"},
}
],
"2024-11-11T04:45:00+01:00",
@ -1418,7 +1418,7 @@ async def test_config_update_errors(
{
"type": "backup/config/update",
"create_backup": {"agent_ids": ["test.test-agent"]},
"schedule": {"days": [], "state": "custom"},
"schedule": {"days": [], "state": "custom_days"},
}
],
"2024-11-11T04:45:00+01:00",