Skip to content

Commit 2f3a3f0

Browse files
CMS-166 - backup:automatic:enable --keep-for parameter fix (#2166)
* CMS-166 - backup:automatic:enable --keep-for parameter fix * Update CHANGELOG.md * Remove redundant expression. Code style. * Adjust test to match code updates * Revise CHANGELOG.md statement
1 parent fd42b99 commit 2f3a3f0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This projec
33

44
## MASTER
55

6+
- Fix `backup:automatic:enable --keep-for` parameter not being respected (#2166)
7+
68
## 2.6.0 - 2021-06-04
79

810
### Added

src/Commands/Backup/Automatic/EnableCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class EnableCommand extends TerminusCommand implements SiteAwareInterface
3333
public function enableSchedule($site_env, $options = ['day' => null, 'keep-for' => null,])
3434
{
3535
list(, $env) = $this->getSiteEnv($site_env);
36+
37+
// Schedule Backup workflow expects 'weekly-ttl' as input option.
38+
if (isset($options['keep-for'])) {
39+
$options['weekly-ttl'] = $options['keep-for'];
40+
}
41+
3642
$env->getBackups()->setBackupSchedule($options);
3743
$this->log()->notice('Backup schedule successfully set.');
3844
}

tests/fixtures/backup-schedule-set-ttl.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
Content-type: application/json
169169
Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:64461ccc-9666-11e6-ae7a-bc764e10d7c2:MDSxnCT7RyKhDzs43QKK5'
170170
Accept: null
171-
body: '{"type":"change_backup_schedule","params":{"backup_schedule":{"0":{"hour":null,"ttl":691200},"1":{"hour":null,"ttl":691200},"2":{"hour":null,"ttl":2764800},"3":{"hour":null,"ttl":691200},"4":{"hour":null,"ttl":691200},"5":{"hour":null,"ttl":691200},"6":{"hour":null,"ttl":691200}}}}'
171+
body: '{"type":"change_backup_schedule","params":{"backup_schedule":{"0":{"hour":null,"ttl":691200},"1":{"hour":null,"ttl":691200},"2":{"hour":null,"ttl":15552000},"3":{"hour":null,"ttl":691200},"4":{"hour":null,"ttl":691200},"5":{"hour":null,"ttl":691200},"6":{"hour":null,"ttl":691200}}}}'
172172
response:
173173
status:
174174
http_version: '1.1'
@@ -250,3 +250,4 @@
250250
Vary: Accept-Encoding
251251
Strict-Transport-Security: max-age=31536000
252252
body: '{"0": {"hour": 16, "ttl": 691200}, "1": {"hour": 16, "ttl": 691200}, "2": {"hour": 16, "ttl": 15552000}, "3": {"hour": 16, "ttl": 691200}, "4": {"hour": 16, "ttl": 691200}, "5": {"hour": 16, "ttl": 691200}, "6": {"hour": 16, "ttl": 691200}}'
253+

0 commit comments

Comments
 (0)