1
0
mirror of https://github.com/coreos/ignition.git synced 2026-02-06 18:47:54 +01:00

sgdisk: retry zap-all operation on failure

sgdisk is a bit weird and will exit with code 2 if there is trouble with the GPT
headers, even it successfully zaps them. Retrying the zap operation will allow
us to be sure that the operation completed successfully.
This commit is contained in:
Alex Crawford
2016-01-11 17:42:31 -08:00
parent 6159283437
commit 94c98bcb48

View File

@@ -59,7 +59,11 @@ func (op *Operation) Commit() error {
if op.wipe {
cmd := exec.Command(sgdiskPath, "--zap-all", op.dev)
if err := op.logger.LogCmd(cmd, "wiping table on %q", op.dev); err != nil {
return fmt.Errorf("wipe failed: %v")
op.logger.Info("potential error encountered while wiping table... retrying")
cmd = exec.Command(sgdiskPath, "--zap-all", op.dev)
if err := op.logger.LogCmd(cmd, "wiping table on %q", op.dev); err != nil {
return fmt.Errorf("wipe failed: %v")
}
}
}