component/snapshots: Create new component
This commit creates a new 'snapshots' component that is intended to manage snapshots and backups.
This commit is contained in:
parent
ea56ff4aac
commit
f58920baf4
7 changed files with 89 additions and 63 deletions
|
|
@ -53,7 +53,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
|
|||
if !bk.StagingOnly {
|
||||
// regular mode: create a temporary staging directory
|
||||
logging.LogMessage(context.IOStream, "Creating new snapshot staging directory")
|
||||
sPath, err = dis.NewSnapshotStagingDir("")
|
||||
sPath, err = dis.Snapshots().NewStagingDir("")
|
||||
if err != nil {
|
||||
return errSnapshotFailed.Wrap(err)
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
|
|||
// staging mode: use dest as a destination
|
||||
sPath = bk.Positionals.Dest
|
||||
if sPath == "" {
|
||||
sPath, err = dis.NewSnapshotStagingDir("")
|
||||
sPath, err = dis.Snapshots().NewStagingDir("")
|
||||
if err != nil {
|
||||
return errSnapshotFailed.Wrap(err)
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
|
|||
// create the archive path
|
||||
archivePath := bk.Positionals.Dest
|
||||
if archivePath == "" {
|
||||
archivePath = dis.NewSnapshotArchivePath("")
|
||||
archivePath = dis.Snapshots().NewArchivePath("")
|
||||
}
|
||||
|
||||
// and write everything into it!
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
|
|||
if !bi.StagingOnly {
|
||||
// regular mode: create a temporary staging directory
|
||||
logging.LogMessage(context.IOStream, "Creating new snapshot staging directory")
|
||||
sPath, err = dis.NewSnapshotStagingDir(instance.Slug)
|
||||
sPath, err = dis.Snapshots().NewStagingDir(instance.Slug)
|
||||
if err != nil {
|
||||
return errSnapshotFailed.Wrap(err)
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
|
|||
// staging mode: use dest as a destination
|
||||
sPath = bi.Positionals.Dest
|
||||
if sPath == "" {
|
||||
sPath, err = dis.NewSnapshotStagingDir(instance.Slug)
|
||||
sPath, err = dis.Snapshots().NewStagingDir(instance.Slug)
|
||||
if err != nil {
|
||||
return errSnapshotFailed.Wrap(err)
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
|
|||
// create the archive path
|
||||
archivePath := bi.Positionals.Dest
|
||||
if archivePath == "" {
|
||||
archivePath = dis.NewSnapshotArchivePath(instance.Slug)
|
||||
archivePath = dis.Snapshots().NewArchivePath(instance.Slug)
|
||||
}
|
||||
|
||||
// and write everything into it!
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ func (si systemupdate) Run(context wisski_distillery.Context) error {
|
|||
for _, d := range []string{
|
||||
dis.Config.DeployRoot,
|
||||
dis.Instances().Path(),
|
||||
dis.SnapshotsStagingPath(),
|
||||
dis.SnapshotsArchivePath(),
|
||||
dis.Snapshots().StagingPath(),
|
||||
dis.Snapshots().ArchivePath(),
|
||||
} {
|
||||
context.Println(d)
|
||||
if err := dis.Core.Environment.MkdirAll(d, environment.DefaultDirPerm); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue