kube-forge v2: embede python with ansible (kubespray) and cobra as cli building tool
This commit is contained in:
30
internal/files/main.go
Normal file
30
internal/files/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package files
|
||||
|
||||
import (
|
||||
"kube-forge/internal/logging"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetWorkingDir() string {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
logging.Log.Fatal(err)
|
||||
}
|
||||
return cwd
|
||||
|
||||
}
|
||||
|
||||
func CreateTempDir() string {
|
||||
tempDir, err := os.MkdirTemp("", "kube-forge-")
|
||||
if err != nil {
|
||||
logging.Log.Fatal(err)
|
||||
}
|
||||
return tempDir
|
||||
}
|
||||
|
||||
func CreateDirWithAllParents(directory string) {
|
||||
err := os.MkdirAll(directory, 0755)
|
||||
if err != nil {
|
||||
logging.Log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user