fsx: Remove environment references
This commit removes the reference to the environment from the fsx package.
This commit is contained in:
parent
5a43ecfaeb
commit
3263920d6b
25 changed files with 167 additions and 183 deletions
|
|
@ -147,7 +147,7 @@ func (sc *stagingContext) CopyFile(dst, src string) error {
|
|||
return err
|
||||
}
|
||||
sc.sendPath(dst)
|
||||
return fsx.CopyFile(sc.ctx, sc.env, dstPath, src)
|
||||
return fsx.CopyFile(sc.ctx, dstPath, src)
|
||||
}
|
||||
|
||||
func (sc *stagingContext) CopyDirectory(dst, src string) error {
|
||||
|
|
@ -160,7 +160,7 @@ func (sc *stagingContext) CopyDirectory(dst, src string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return fsx.CopyDirectory(sc.ctx, sc.env, dstPath, src, func(dst, src string) {
|
||||
return fsx.CopyDirectory(sc.ctx, dstPath, src, func(dst, src string) {
|
||||
sc.sendPath(dst)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/logging"
|
||||
"github.com/tkw1536/goprogram/status"
|
||||
"golang.org/x/exp/slices"
|
||||
|
|
@ -119,7 +119,7 @@ func (backup *Backup) run(ctx context.Context, progress io.Writer, exporter *Exp
|
|||
defer st.Stop()
|
||||
|
||||
instancesBackupDir := filepath.Join(backup.Description.Dest, "instances")
|
||||
if err := exporter.Environment.Mkdir(instancesBackupDir, environment.DefaultDirPerm); err != nil {
|
||||
if err := fsx.Mkdir(instancesBackupDir, fsx.DefaultDirPerm); err != nil {
|
||||
backup.InstanceListErr = err
|
||||
return nil
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ func (backup *Backup) run(ctx context.Context, progress io.Writer, exporter *Exp
|
|||
|
||||
Handler: func(instance *wisski.WissKI, index int, writer io.Writer) Snapshot {
|
||||
dir := filepath.Join(instancesBackupDir, instance.Slug)
|
||||
if err := exporter.Environment.Mkdir(dir, environment.DefaultDirPerm); err != nil {
|
||||
if err := fsx.Mkdir(dir, fsx.DefaultDirPerm); err != nil {
|
||||
return Snapshot{
|
||||
ErrPanic: err,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/passwordx"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/tkw1536/pkglib/password"
|
||||
)
|
||||
|
|
@ -51,7 +50,7 @@ func (dis *Exporter) ArchivePath() string {
|
|||
// The path is guaranteed to not exist.
|
||||
func (dis *Exporter) NewArchivePath(prefix string) (path string) {
|
||||
// TODO: Consider moving these into a subdirectory with the provided prefix.
|
||||
for path == "" || fsx.Exists(dis.Environment, path) {
|
||||
for path == "" || fsx.Exists(path) {
|
||||
name := dis.newSnapshotName(prefix) + ".tar.gz"
|
||||
path = filepath.Join(dis.ArchivePath(), name)
|
||||
}
|
||||
|
|
@ -75,7 +74,7 @@ func (*Exporter) newSnapshotName(prefix string) string {
|
|||
func (dis *Exporter) NewStagingDir(prefix string) (path string, err error) {
|
||||
for path == "" || os.IsExist(err) {
|
||||
path = filepath.Join(dis.StagingPath(), dis.newSnapshotName(prefix))
|
||||
err = dis.Still.Environment.Mkdir(path, environment.DefaultFilePerm)
|
||||
err = fsx.Mkdir(path, fsx.DefaultFilePerm)
|
||||
}
|
||||
if err != nil {
|
||||
path = ""
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/logging"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/targz"
|
||||
"github.com/tkw1536/goprogram/status"
|
||||
|
|
@ -74,7 +74,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
|
|||
|
||||
// create the staging directory
|
||||
logging.LogMessage(progress, ctx, "Creating staging directory")
|
||||
err = exporter.Environment.Mkdir(stagingDir, environment.DefaultDirPerm)
|
||||
err = fsx.Mkdir(stagingDir, fsx.DefaultDirPerm)
|
||||
if !os.IsExist(err) && err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
|
|||
logging.ProgressF(progress, ctx, reportPath)
|
||||
|
||||
// create the path
|
||||
report, err := exporter.Environment.Create(reportPath, environment.DefaultFilePerm)
|
||||
report, err := fsx.Create(reportPath, fsx.DefaultFilePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func (pv *Provision) Provision(progress io.Writer, ctx context.Context, flags Pr
|
|||
|
||||
// check that the base directory does not exist
|
||||
logging.LogMessage(progress, ctx, "Checking that base directory %s does not exist", instance.FilesystemBase)
|
||||
if fsx.IsDirectory(pv.Environment, instance.FilesystemBase) {
|
||||
if fsx.IsDirectory(instance.FilesystemBase) {
|
||||
return nil, ErrInstanceAlreadyExists
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/tkw1536/pkglib/lazy"
|
||||
)
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ func (sql *SQL) Stack(env environment.Environment) component.StackWithResources
|
|||
"HTTPS_ENABLED": sql.Config.HTTP.HTTPSEnabledEnv(),
|
||||
},
|
||||
|
||||
MakeDirsPerm: environment.DefaultDirPerm,
|
||||
MakeDirsPerm: fsx.DefaultDirPerm,
|
||||
MakeDirs: []string{
|
||||
"data",
|
||||
"imports",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/logging"
|
||||
"github.com/gliderlabs/ssh"
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ func (ssh2 *SSH2) makeHostKey(progress io.Writer, ctx context.Context, key HostK
|
|||
}
|
||||
|
||||
// generate and write private key as PEM
|
||||
privateKeyFile, err := ssh2.Environment.Create(path, environment.DefaultFilePerm)
|
||||
privateKeyFile, err := fsx.Create(path, fsx.DefaultFilePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ func (is StackWithResources) Install(ctx context.Context, progress io.Writer, co
|
|||
|
||||
// copy over file from context
|
||||
logging.ProgressF(progress, ctx, "[copy] %s (from %s)\n", dst, src)
|
||||
if err := fsx.CopyFile(ctx, env, dst, src); err != nil {
|
||||
if err := fsx.CopyFile(ctx, dst, src); err != nil {
|
||||
return errors.Wrapf(err, "Unable to copy file %s", src)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import (
|
|||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/cli"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/tkw1536/goprogram/exit"
|
||||
)
|
||||
|
||||
|
|
@ -23,9 +21,6 @@ var errOpenConfig = exit.Error{
|
|||
// NewDistillery creates a new distillery from the provided flags
|
||||
func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (dis *Distillery, err error) {
|
||||
dis = &Distillery{
|
||||
Still: component.Still{
|
||||
Environment: new(environment.Native),
|
||||
},
|
||||
Upstream: Upstream{
|
||||
SQL: "127.0.0.1:3306",
|
||||
Triplestore: "127.0.0.1:7200",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue