forked from toolshed/abra
refactor: less quotes
This commit is contained in:
@ -142,7 +142,7 @@ func LoadAppFiles(servers ...string) (AppFiles, error) {
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("collecting metadata from '%v' servers: '%s'", len(servers), strings.Join(servers, ", "))
|
||||
logrus.Debugf("collecting metadata from %v servers: %s", len(servers), strings.Join(servers, ", "))
|
||||
|
||||
for _, server := range servers {
|
||||
serverDir := path.Join(ABRA_SERVER_FOLDER, server)
|
||||
@ -168,7 +168,7 @@ func LoadAppFiles(servers ...string) (AppFiles, error) {
|
||||
func GetApp(apps AppFiles, name AppName) (App, error) {
|
||||
appFile, exists := apps[name]
|
||||
if !exists {
|
||||
return App{}, fmt.Errorf("cannot find app with name '%s'", name)
|
||||
return App{}, fmt.Errorf("cannot find app with name %s", name)
|
||||
}
|
||||
|
||||
app, err := readAppEnvFile(appFile, name)
|
||||
@ -268,7 +268,7 @@ func TemplateAppEnvSample(appType, appName, server, domain, recipe string) error
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf("copied '%s' to '%s'", envSamplePath, appEnvPath)
|
||||
logrus.Debugf("copied %s to %s", envSamplePath, appEnvPath)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -324,7 +324,7 @@ func GetAppStatuses(appFiles AppFiles) (map[string]map[string]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("retrieved app statuses: '%s'", statuses)
|
||||
logrus.Debugf("retrieved app statuses: %s", statuses)
|
||||
|
||||
return statuses, nil
|
||||
}
|
||||
@ -343,13 +343,13 @@ func GetAppComposeFiles(recipe string, appEnv AppEnv) ([]string, error) {
|
||||
|
||||
composeFileEnvVar := appEnv["COMPOSE_FILE"]
|
||||
envVars := strings.Split(composeFileEnvVar, ":")
|
||||
logrus.Debugf("COMPOSE_FILE detected ('%s'), loading '%s'", composeFileEnvVar, strings.Join(envVars, ", "))
|
||||
logrus.Debugf("COMPOSE_FILE detected (%s), loading %s", composeFileEnvVar, strings.Join(envVars, ", "))
|
||||
for _, file := range strings.Split(composeFileEnvVar, ":") {
|
||||
path := fmt.Sprintf("%s/%s/%s", APPS_DIR, recipe, file)
|
||||
composeFiles = append(composeFiles, path)
|
||||
}
|
||||
|
||||
logrus.Debugf("retrieved '%s' configs for '%s'", strings.Join(composeFiles, ", "), recipe)
|
||||
logrus.Debugf("retrieved %s configs for %s", strings.Join(composeFiles, ", "), recipe)
|
||||
|
||||
return composeFiles, nil
|
||||
}
|
||||
@ -363,7 +363,7 @@ func GetAppComposeConfig(recipe string, opts stack.Deploy, appEnv AppEnv) (*comp
|
||||
return &composetypes.Config{}, err
|
||||
}
|
||||
|
||||
logrus.Debugf("retrieved '%s' for '%s'", compose.Filename, recipe)
|
||||
logrus.Debugf("retrieved %s for %s", compose.Filename, recipe)
|
||||
|
||||
return compose, nil
|
||||
}
|
||||
|
@ -24,12 +24,12 @@ var REPOS_BASE_URL = "https://git.coopcloud.tech/coop-cloud"
|
||||
func GetServers() ([]string, error) {
|
||||
var servers []string
|
||||
|
||||
servers, err := getAllFoldersInDirectory(ABRA_SERVER_FOLDER)
|
||||
servers, err := GetAllFoldersInDirectory(ABRA_SERVER_FOLDER)
|
||||
if err != nil {
|
||||
return servers, err
|
||||
}
|
||||
|
||||
logrus.Debugf("retrieved '%v' servers: '%s'", len(servers), servers)
|
||||
logrus.Debugf("retrieved %v servers: %s", len(servers), servers)
|
||||
|
||||
return servers, nil
|
||||
}
|
||||
@ -43,20 +43,20 @@ func ReadEnv(filePath string) (AppEnv, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logrus.Debugf("read '%s' from '%s'", envFile, filePath)
|
||||
logrus.Debugf("read %s from %s", envFile, filePath)
|
||||
|
||||
return envFile, nil
|
||||
}
|
||||
|
||||
// ReadServerNames retrieves all server names.
|
||||
func ReadServerNames() ([]string, error) {
|
||||
serverNames, err := getAllFoldersInDirectory(ABRA_SERVER_FOLDER)
|
||||
serverNames, err := GetAllFoldersInDirectory(ABRA_SERVER_FOLDER)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logrus.Debugf("read '%s' from '%s'", strings.Join(serverNames, ","), ABRA_SERVER_FOLDER)
|
||||
logrus.Debugf("read %s from %s", strings.Join(serverNames, ","), ABRA_SERVER_FOLDER)
|
||||
|
||||
return serverNames, nil
|
||||
}
|
||||
@ -80,7 +80,7 @@ func getAllFilesInDirectory(directory string) ([]fs.FileInfo, error) {
|
||||
|
||||
realPath, err := filepath.EvalSymlinks(filePath)
|
||||
if err != nil {
|
||||
logrus.Warningf("broken symlink in your abra config folders: '%s'", filePath)
|
||||
logrus.Warningf("broken symlink in your abra config folders: %s", filePath)
|
||||
} else {
|
||||
realFile, err := os.Stat(realPath)
|
||||
if err != nil {
|
||||
@ -104,7 +104,7 @@ func getAllFoldersInDirectory(directory string) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
if len(files) == 0 {
|
||||
return nil, fmt.Errorf("directory is empty: '%s'", directory)
|
||||
return nil, fmt.Errorf("directory is empty: %s", directory)
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
@ -113,7 +113,7 @@ func getAllFoldersInDirectory(directory string) ([]string, error) {
|
||||
filePath := path.Join(directory, file.Name())
|
||||
realDir, err := filepath.EvalSymlinks(filePath)
|
||||
if err != nil {
|
||||
logrus.Warningf("broken symlink in your abra config folders: '%s'", filePath)
|
||||
logrus.Warningf("broken symlink in your abra config folders: %s", filePath)
|
||||
} else if stat, err := os.Stat(realDir); err == nil && stat.IsDir() {
|
||||
// path is a directory
|
||||
folders = append(folders, file.Name())
|
||||
@ -127,7 +127,7 @@ func getAllFoldersInDirectory(directory string) ([]string, error) {
|
||||
// EnsureAbraDirExists checks for the abra config folder and throws error if not
|
||||
func EnsureAbraDirExists() error {
|
||||
if _, err := os.Stat(ABRA_DIR); os.IsNotExist(err) {
|
||||
logrus.Debugf("'%s' does not exist, creating it", ABRA_DIR)
|
||||
logrus.Debugf("%s does not exist, creating it", ABRA_DIR)
|
||||
if err := os.Mkdir(ABRA_DIR, 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -161,7 +161,7 @@ func ReadAbraShEnvVars(abraSh string) (map[string]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("read '%s' from '%s'", envVars, abraSh)
|
||||
logrus.Debugf("read %s from %s", envVars, abraSh)
|
||||
|
||||
return envVars, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user