Update to newest pkglib

This commit is contained in:
Tom Wiesing 2023-04-09 22:00:24 +02:00
parent 1bdcb6e3b4
commit 7ff2ecf7fe
No known key found for this signature in database
11 changed files with 95 additions and 41 deletions

View file

@ -120,7 +120,11 @@ func (bs cBootstrap) Run(context wisski_distillery.Context) error {
}
{
if !fsx.IsRegular(cfgPath) {
isFile, err := fsx.IsRegular(cfgPath, false)
if err != nil {
return errBootstrapWriteConfig.Wrap(err)
}
if !isFile {
// generate the configuration from the template
cfg := tpl.Generate()

View file

@ -28,7 +28,11 @@ func (monday) Description() wisski_distillery.Description {
}
func (monday monday) AfterParse() error {
if !fsx.IsRegular(monday.Positionals.GraphdbZip) {
isFile, err := fsx.IsRegular(monday.Positionals.GraphdbZip, false)
if err != nil {
return err
}
if !isFile {
return errNoGraphDBZip.WithMessageF(monday.Positionals.GraphdbZip)
}
return nil

View file

@ -59,9 +59,15 @@ func (r reserve) Run(context wisski_distillery.Context) (err error) {
}
// check that the base directory does not exist
logging.LogMessage(context.Stderr, "Checking that base directory %s does not exist", instance.FilesystemBase)
if fsx.IsDirectory(instance.FilesystemBase) {
return errReserveAlreadyExists.WithMessageF(slug)
{
logging.LogMessage(context.Stderr, "Checking that base directory %s does not exist", instance.FilesystemBase)
exists, err := fsx.Exists(instance.FilesystemBase)
if err != nil {
return errProvisionGeneric.Wrap(err)
}
if exists {
return errReserveAlreadyExists.WithMessageF(slug)
}
}
// setup docker stack

View file

@ -46,8 +46,12 @@ var errNoGraphDBZip = exit.Error{
}
func (s systemupdate) AfterParse() error {
// TODO: Use a generic environment here!
if !fsx.IsRegular(s.Positionals.GraphdbZip) {
isFile, err := fsx.IsRegular(s.Positionals.GraphdbZip, true)
if err != nil {
return err
}
if !isFile {
return errNoGraphDBZip.WithMessageF(s.Positionals.GraphdbZip)
}
return nil