Created
February 2, 2017 17:46
-
-
Save david-martin/3c1f8e6ea006e3c4ac0795c184226f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/main.go b/main.go | |
index 42c423b..04e9935 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -4,12 +4,14 @@ import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
+ "github.com/codeskyblue/go-sh" | |
"io/ioutil" | |
"log" | |
"os" | |
"os/exec" | |
"runtime" | |
"strings" | |
+ "syscall" | |
"time" | |
"github.com/BurntSushi/toml" | |
@@ -146,16 +148,16 @@ func CreatePVDirectories(fhCupDir string) { | |
// TODO: SELinux _only_ | |
if isLinux() { | |
// Change security context of this folder to prevent permissions errors | |
- // var cmd = sh.Command("sh", "-c", fmt.Sprintf("chcon -R -t svirt_sandbox_file_t %s/cluster/volumes/devpv%v", fhCupDir, i)) | |
- // cmd.Stdout = os.Stdout | |
- // cmd.Stderr = os.Stderr | |
- // cmd.Stdin = os.Stdin | |
- | |
- // if err := cmd.Run(); err != nil { | |
- // fmt.Println("Error changing security context on PVs") | |
- // fmt.Fprintln(os.Stderr, err) | |
- // os.Exit(1) | |
- // } | |
+ var cmd = sh.Command("sh", "-c", fmt.Sprintf("chcon -R -t svirt_sandbox_file_t %s/cluster/volumes/devpv%v", fhCupDir, i)) | |
+ cmd.Stdout = os.Stdout | |
+ cmd.Stderr = os.Stderr | |
+ cmd.Stdin = os.Stdin | |
+ | |
+ if err := cmd.Run(); err != nil { | |
+ fmt.Println("Error changing security context on PVs") | |
+ fmt.Fprintln(os.Stderr, err) | |
+ os.Exit(1) | |
+ } | |
} | |
} | |
} | |
@@ -267,7 +269,7 @@ func CreatePVS(fhCupDir string) { | |
} | |
// Replace paths with real-paths | |
- pvConfig := strings.Replace(string(input), "REPLACE_ME", fmt.Sprintf("%s/cluster/volumes/", fhCupDir), -1) | |
+ pvConfig := strings.Replace(string(input), "REPLACE_ME", fmt.Sprintf("%s/cluster/volumes", fhCupDir), -1) | |
err = ioutil.WriteFile(fmt.Sprintf("%s/pvs.json", fhCupDir), []byte(pvConfig), 0755) | |
if err != nil { | |
@@ -490,6 +492,7 @@ func RunFHCCommand(arguments []string) { | |
} | |
func main() { | |
+ syscall.Umask(0) | |
Cup() | |
var conf Config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment