Update to newest pkglib
This commit is contained in:
parent
1bdcb6e3b4
commit
7ff2ecf7fe
11 changed files with 95 additions and 41 deletions
|
|
@ -51,12 +51,17 @@ func (dis *Exporter) ArchivePath() string {
|
|||
// NewArchivePath returns the path to a new archive with the provided prefix.
|
||||
// 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(path) {
|
||||
for {
|
||||
name := dis.newSnapshotName(prefix) + ".tar.gz"
|
||||
path = filepath.Join(dis.ArchivePath(), name)
|
||||
|
||||
// Only return if the path does not exist
|
||||
// FIXME: ignoring the error here
|
||||
exists, _ := fsx.Exists(path)
|
||||
if !exists {
|
||||
return path
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// newSnapshot name returns a new basename for a snapshot with the provided prefix.
|
||||
|
|
|
|||
|
|
@ -42,9 +42,15 @@ func (pv *Provision) Provision(progress io.Writer, ctx context.Context, flags Pr
|
|||
}
|
||||
|
||||
// check that the base directory does not exist
|
||||
logging.LogMessage(progress, "Checking that base directory %s does not exist", instance.FilesystemBase)
|
||||
if fsx.IsDirectory(instance.FilesystemBase) {
|
||||
return nil, ErrInstanceAlreadyExists
|
||||
{
|
||||
logging.LogMessage(progress, "Checking that base directory %s does not exist", instance.FilesystemBase)
|
||||
exists, err := fsx.Exists(instance.FilesystemBase)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if exists {
|
||||
return nil, ErrInstanceAlreadyExists
|
||||
}
|
||||
}
|
||||
|
||||
// Store in the instances table!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue