Fix fail to start backup after stopping a backup
When there is an abrupt disconnect (target is shut down, network glitch), the backup_in_progress flag remains, resulting in error to start a new backup process. This commit adds a new condition to check if backup_in_progress flag was created less than 20 minutes ago, so block the process otherwise, ignore the flag and continue the backup process. Test Plan: - PASS: Run backup process AIO-SX without backup_in_progress flag - PASS: Run backup process AIO-SX with backup_in_progress flag (before 20 minutes since the last backup interrupted) - PASS: Run backup process AIO-SX with backup_in_progress flag (after 20 minutes since the last backup interrupted) Closes-Bug: 2002128 Signed-off-by: Guilherme Schons <guilherme.dossantosschons@windriver.com> Change-Id: I3f51c41005208e96d747b1c89931471b218f709b
This commit is contained in:
committed by
Guilherme Schons
parent
76d6f93a16
commit
2b5a143b18
@@ -14,9 +14,17 @@
|
||||
path: "{{ backup_in_progress_flag }}"
|
||||
register: backup_in_progress
|
||||
|
||||
- name: Fail if backup is already in progress
|
||||
fail:
|
||||
msg: "Backup is already in progress!"
|
||||
- block:
|
||||
- name: Get unix timestamp from the system
|
||||
shell: "date +%s"
|
||||
register: unix_timestamp
|
||||
|
||||
- name: Fail if backup is already in progress for less than 20 minutes
|
||||
fail:
|
||||
msg: >-
|
||||
A backup has already been started less than 20 minutes ago.
|
||||
Wait to start a new backup or manually remove the backup flag in {{ backup_in_progress_flag }}
|
||||
when: (unix_timestamp.stdout | float - backup_in_progress.stat.ctime) < 1200
|
||||
when: backup_in_progress.stat.exists
|
||||
|
||||
- name: Check if it is the active controller
|
||||
|
||||
Reference in New Issue
Block a user