Skip to content

Commit

Permalink
Avoid collection-status trunc bug (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptobioz authored and raphink committed Jun 26, 2017
1 parent cafca9b commit a5b7e2c
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions engines/duplicity.go
Expand Up @@ -182,23 +182,37 @@ func (d *DuplicityEngine) verify() (err error) {

// status gets the latest backup date info from duplicity
func (d *DuplicityEngine) status() (err error) {
var stdout string
attempts := 3
v := d.Volume
_, stdout, err := d.launchDuplicity(
[]string{
"collection-status",
"--s3-use-new-style",
"--ssh-options", "-oStrictHostKeyChecking=no",
"--no-encryption",
"--name", v.Name,
v.Target,
},
[]string{
v.Mount,
cacheMount,
},
)
if err != nil {
err = fmt.Errorf("failed to launch duplicity: %v", err)
for i := 1; i <= attempts; i++ {
_, stdout, err = d.launchDuplicity(
[]string{
"collection-status",
"--s3-use-new-style",
"--ssh-options", "-oStrictHostKeyChecking=no",
"--no-encryption",
"--name", v.Name,
v.Target,
},
[]string{
v.Mount,
cacheMount,
},
)
if err != nil {
err = fmt.Errorf("failed to launch duplicity: %v", err)
return
}
if strings.Contains(stdout, "No orphaned or incomplete backup sets found.") {
break
} else {
log.Debug("No end string found, the collection-status output may be wrong, retrying ...")
}
}

if strings.Contains(stdout, "No orphaned or incomplete backup sets found.") {
err = fmt.Errorf("failed to retrieve full output from collection-status after %v attempts", attempts)
return
}

Expand Down

0 comments on commit a5b7e2c

Please sign in to comment.