abra/pkg/server/server.go
cellarspoon a07e71f7df
Some checks failed
continuous-integration/drone/push Build is failing
fix: grand ssh, provisioning, perms refactor
See coop-cloud/organising#280.
See coop-cloud/organising#273.
2021-12-22 20:08:15 +01:00

28 lines
510 B
Go

package server
import (
"os"
"path"
"coopcloud.tech/abra/pkg/config"
"github.com/sirupsen/logrus"
)
// CreateServerDir creates a server directory under ~/.abra.
func CreateServerDir(serverName string) error {
serverPath := path.Join(config.ABRA_DIR, "servers", serverName)
if err := os.Mkdir(serverPath, 0764); err != nil {
if !os.IsExist(err) {
return err
}
logrus.Infof("%s already exists", serverPath)
return nil
}
logrus.Infof("successfully created %s", serverPath)
return nil
}