component: Automatically determine names

This commit is contained in:
Tom Wiesing 2022-10-17 20:39:53 +02:00
parent 10df1c3243
commit e320bb37bb
No known key found for this signature in database
31 changed files with 84 additions and 113 deletions

View file

@ -27,8 +27,6 @@ type Exporter struct {
Backupable []component.Backupable
}
func (Exporter) Name() string { return "snapshots" }
// Path returns the path that contains all snapshot related data.
func (dis *Exporter) Path() string {
return filepath.Join(dis.Config.DeployRoot, "snapshots")
@ -74,7 +72,7 @@ func (*Exporter) newSnapshotName(prefix string) string {
func (dis *Exporter) NewStagingDir(prefix string) (path string, err error) {
for path == "" || environment.IsExist(err) {
path = filepath.Join(dis.StagingPath(), dis.newSnapshotName(prefix))
err = dis.Core.Environment.Mkdir(path, environment.DefaultFilePerm)
err = dis.Still.Environment.Mkdir(path, environment.DefaultFilePerm)
}
if err != nil {
path = ""