|
@@ -81,7 +81,7 @@ func HandleFSHEdit(w http.ResponseWriter, r *http.Request) {
|
|
} else if opr == "set" {
|
|
} else if opr == "set" {
|
|
//Set
|
|
//Set
|
|
newFsOption := buildOptionFromRequestForm(r)
|
|
newFsOption := buildOptionFromRequestForm(r)
|
|
- log.Println(newFsOption)
|
|
|
|
|
|
+ //log.Println(newFsOption)
|
|
|
|
|
|
//Read and remove the original settings from the config file
|
|
//Read and remove the original settings from the config file
|
|
err := setFSHConfigByGroupAndId(group, uuid, newFsOption)
|
|
err := setFSHConfigByGroupAndId(group, uuid, newFsOption)
|
|
@@ -115,6 +115,10 @@ func getFSHConfigFromGroupAndUUID(group string, uuid string) (*fs.FileSystemOpti
|
|
return nil, errors.New("Configuration file not found")
|
|
return nil, errors.New("Configuration file not found")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if !fileExists(filepath.Dir(targerFile)) {
|
|
|
|
+ os.MkdirAll(filepath.Dir(targerFile), 0775)
|
|
|
|
+ }
|
|
|
|
+
|
|
//Load and parse the file
|
|
//Load and parse the file
|
|
configContent, err := ioutil.ReadFile(targerFile)
|
|
configContent, err := ioutil.ReadFile(targerFile)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -154,6 +158,10 @@ func setFSHConfigByGroupAndId(group string, uuid string, options fs.FileSystemOp
|
|
return errors.New("Configuration file not found")
|
|
return errors.New("Configuration file not found")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if !fileExists(filepath.Dir(targerFile)) {
|
|
|
|
+ os.MkdirAll(filepath.Dir(targerFile), 0775)
|
|
|
|
+ }
|
|
|
|
+
|
|
//Load and parse the file
|
|
//Load and parse the file
|
|
configContent, err := ioutil.ReadFile(targerFile)
|
|
configContent, err := ioutil.ReadFile(targerFile)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -180,7 +188,7 @@ func setFSHConfigByGroupAndId(group string, uuid string, options fs.FileSystemOp
|
|
|
|
|
|
//Write config back to file
|
|
//Write config back to file
|
|
js, _ := json.MarshalIndent(newConfig, "", " ")
|
|
js, _ := json.MarshalIndent(newConfig, "", " ")
|
|
- return ioutil.WriteFile(targerFile, js, 0755)
|
|
|
|
|
|
+ return ioutil.WriteFile(targerFile, js, 777)
|
|
}
|
|
}
|
|
|
|
|
|
//Handle Storage Pool toggle on-off
|
|
//Handle Storage Pool toggle on-off
|
|
@@ -397,7 +405,7 @@ func HandleStoragePoolRemove(w http.ResponseWriter, r *http.Request) {
|
|
if len(newConfigs) > 0 {
|
|
if len(newConfigs) > 0 {
|
|
js, _ := json.Marshal(newConfigs)
|
|
js, _ := json.Marshal(newConfigs)
|
|
resultingJson := pretty.Pretty(js)
|
|
resultingJson := pretty.Pretty(js)
|
|
- ioutil.WriteFile(targetConfigFile, resultingJson, 755)
|
|
|
|
|
|
+ ioutil.WriteFile(targetConfigFile, resultingJson, 777)
|
|
} else {
|
|
} else {
|
|
os.Remove(targetConfigFile)
|
|
os.Remove(targetConfigFile)
|
|
}
|
|
}
|
|
@@ -431,7 +439,6 @@ func buildOptionFromRequestForm(r *http.Request) fs.FileSystemOption {
|
|
}
|
|
}
|
|
|
|
|
|
func HandleStorageNewFsHandler(w http.ResponseWriter, r *http.Request) {
|
|
func HandleStorageNewFsHandler(w http.ResponseWriter, r *http.Request) {
|
|
-
|
|
|
|
newFsOption := buildOptionFromRequestForm(r)
|
|
newFsOption := buildOptionFromRequestForm(r)
|
|
|
|
|
|
type errorObject struct {
|
|
type errorObject struct {
|