snapshots: Handle as separate components

This commit is contained in:
Tom Wiesing 2022-10-02 18:17:47 +02:00
parent 698f04e13e
commit 3b112f1b8e
No known key found for this signature in database
27 changed files with 960 additions and 789 deletions

View file

@ -2,7 +2,7 @@ package cmd
import (
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
"github.com/FAU-CDI/wisski-distillery/internal/backup"
"github.com/FAU-CDI/wisski-distillery/internal/component/snapshots"
"github.com/FAU-CDI/wisski-distillery/internal/core"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
"github.com/FAU-CDI/wisski-distillery/pkg/logging"
@ -52,7 +52,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
var sPath string
if !bk.StagingOnly {
// regular mode: create a temporary staging directory
logging.LogMessage(context.IOStream, "Creating new snapshot staging directory")
logging.LogMessage(context.IOStream, "Creating new backup staging directory")
sPath, err = dis.SnapshotManager().NewStagingDir("")
if err != nil {
return errSnapshotFailed.Wrap(err)
@ -82,7 +82,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
context.Println(sPath)
logging.LogOperation(func() error {
backup := backup.New(context.IOStream, dis, backup.Description{
backup := dis.SnapshotManager().NewBackup(context.IOStream, snapshots.BackupDescription{
Dest: sPath,
Auto: bk.Positionals.Dest == "",
ConcurrentSnapshots: bk.ConcurrentSnapshots,

View file

@ -131,13 +131,13 @@ func (si systemupdate) Run(context wisski_distillery.Context) error {
return nil
},
}, dis.Installables())
}, dis.Installable())
}, context.IOStream, "Performing Stack Updates"); err != nil {
return err
}
if err := logging.LogOperation(func() error {
for _, component := range dis.Updateable() {
for _, component := range dis.Updatable() {
name := component.Name()
if err := logging.LogOperation(func() error {
return component.Update(context.IOStream)