The factory install flags were being created after the backup was
taken, causing them to be missing after a factory restore. This commit
creates the flags before creating the backup, and if the backup fails,
the flags are removed.
Test Plan:
01. PASS - Run factory install and verify that the generated backup
contains the flag files.
02. PASS - Run factory install and cause a failure during the backup
creation. Verify that the flag files are deleted properly.
03. PASS - Run a factory restore and verify that the flag files are
restored inside /var/lib/factory-install dir.
04. PASS - Run a subcloud enrollment post factory restore and verify
that the task that checks if the factory setup was complete runs
without issues.
Story: 2011455
Task: 52752
Change-Id: I7ecdd2ced29855cde4a73f64a49a554a6cacfbdd
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
21 lines
612 B
Desktop File
21 lines
612 B
Desktop File
[Unit]
|
|
Description=Factory Installation Backup
|
|
ConditionPathExists=/var/lib/factory-install/enabled
|
|
ConditionPathExists=/var/lib/factory-install/stage/backup
|
|
ConditionPathExists=!/var/lib/factory-install/state/backup
|
|
After=factory-install-tests.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=root
|
|
ExecStart=/usr/bin/run-parts --verbose --exit-on-error /var/lib/factory-install/backup
|
|
ExecStartPost=+/var/lib/factory-install/utils/disable-factory-install
|
|
StandardOutput=append:/var/log/factory-install.log
|
|
RemainAfterExit=yes
|
|
Restart=no
|
|
TimeoutStartSec=infinity
|
|
TasksMax=infinity
|
|
|
|
[Install]
|
|
WantedBy=factory-install.target
|