Fix regression in stagingContext
This commit is contained in:
parent
3a893bbfb6
commit
fcdb3a1d6a
14 changed files with 78 additions and 70 deletions
|
|
@ -24,7 +24,7 @@ func (Bookkeeping) SnapshotNeedsRunning() bool { return false }
|
|||
func (Bookkeeping) SnapshotName() string { return "bookkeeping.txt" }
|
||||
|
||||
// Snapshot creates a snapshot of this instance
|
||||
func (*Bookkeeping) Snapshot(wisski models.Instance, scontext component.StagingContext) error {
|
||||
func (*Bookkeeping) Snapshot(wisski models.Instance, scontext *component.StagingContext) error {
|
||||
return scontext.AddFile(".", func(ctx context.Context, file io.Writer) error {
|
||||
_, err := fmt.Fprintf(file, "%#v\n", wisski)
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func (*Config) BackupName() string {
|
|||
return "config"
|
||||
}
|
||||
|
||||
func (control *Config) Backup(scontext component.StagingContext) error {
|
||||
func (control *Config) Backup(scontext *component.StagingContext) error {
|
||||
files := control.backupFiles()
|
||||
|
||||
return scontext.AddDirectory("", func(ctx context.Context) error {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ func (Filesystem) SnapshotNeedsRunning() bool { return false }
|
|||
func (Filesystem) SnapshotName() string { return "data" }
|
||||
|
||||
// Snapshot creates a snapshot of this instance
|
||||
func (*Filesystem) Snapshot(wisski models.Instance, context component.StagingContext) error {
|
||||
func (*Filesystem) Snapshot(wisski models.Instance, context *component.StagingContext) error {
|
||||
return context.CopyDirectory(".", wisski.FilesystemBase)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func (Pathbuilders) SnapshotNeedsRunning() bool { return true }
|
|||
|
||||
func (Pathbuilders) SnapshotName() string { return "pathbuilders" }
|
||||
|
||||
func (pbs *Pathbuilders) Snapshot(wisski models.Instance, scontext component.StagingContext) error {
|
||||
func (pbs *Pathbuilders) Snapshot(wisski models.Instance, scontext *component.StagingContext) error {
|
||||
return scontext.AddDirectory(".", func(ctx context.Context) error {
|
||||
builders, err := pbs.Dependencies.Instances.Instance(ctx, wisski).Pathbuilder().GetAll(ctx, nil)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -117,19 +117,19 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
|
|||
// and retain a log entry
|
||||
var entry models.Export
|
||||
logging.LogOperation(func() error {
|
||||
var sl export
|
||||
var export export
|
||||
if task.Instance == nil {
|
||||
task.BackupDescription.Dest = stagingDir
|
||||
backup := exporter.NewBackup(ctx, progress, task.BackupDescription)
|
||||
sl = &backup
|
||||
export = &backup
|
||||
} else {
|
||||
task.SnapshotDescription.Dest = stagingDir
|
||||
snapshot := exporter.NewSnapshot(ctx, task.Instance, progress, task.SnapshotDescription)
|
||||
sl = &snapshot
|
||||
export = &snapshot
|
||||
}
|
||||
|
||||
// create a log entry
|
||||
entry = sl.LogEntry()
|
||||
entry = export.LogEntry()
|
||||
|
||||
// write the machine report
|
||||
{
|
||||
|
|
@ -141,7 +141,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
|
|||
return err
|
||||
}
|
||||
|
||||
if err := sl.ReportMachine(report); err != nil {
|
||||
if err := export.ReportMachine(report); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
|
|||
return err
|
||||
}
|
||||
|
||||
if err := sl.ReportPlain(report); err != nil {
|
||||
if err := export.ReportPlain(report); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ func (snapshot Snapshot) ReportPlain(w io.Writer) error {
|
|||
|
||||
io.WriteString(ww, "======= Errors =======\n")
|
||||
fmt.Fprintf(ww, "Panic: %v\n", snapshot.ErrPanic)
|
||||
fmt.Fprintf(ww, "Start: %s\n", snapshot.ErrStart)
|
||||
fmt.Fprintf(ww, "Stop: %s\n", snapshot.ErrStop)
|
||||
fmt.Fprintf(ww, "Start: %v\n", snapshot.ErrStart)
|
||||
fmt.Fprintf(ww, "Stop: %v\n", snapshot.ErrStop)
|
||||
|
||||
fmt.Fprintf(ww, "Errors: %s\n", snapshot.Errors)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue