Skip to content

Commit

Permalink
fix app servers naming
Browse files Browse the repository at this point in the history
  • Loading branch information
thevan4 committed Jan 19, 2021
1 parent 30913cb commit c0dac4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/consul-put.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func readAndPutManifest(consulKVClient *consulapi.KV,
func putConsulData(consulKVClient *consulapi.KV,
servicesDirectory string,
manifestName string,
appSrvrsName string,
appServersName string,
rootPath string,
isForceUpdate bool) error {
servicesPaths, err := getServicesPaths(servicesDirectory)
Expand All @@ -153,13 +153,13 @@ func putConsulData(consulKVClient *consulapi.KV,
isForceUpdate); err != nil {
return fmt.Errorf("can't put manifest got error %v", err)
}
} else if maa.IsDir() && maa.Name() == appSrvrsName {
} else if maa.IsDir() && maa.Name() == appServersName {
// TODO: refactor
isAppSrvrsPathExist, err := isKeyExist(consulKVClient, rootPath)
isAppServersPathExist, err := isKeyExist(consulKVClient, rootPath)
if err != nil {
return err
}
if !isAppSrvrsPathExist {
if !isAppServersPathExist {
appF := &consulapi.KVPair{Key: rootPath + servicePath + "/" + maa.Name() + "/", Value: nil}
_, err = consulKVClient.Put(appF, nil)
if err != nil {
Expand All @@ -169,12 +169,12 @@ func putConsulData(consulKVClient *consulapi.KV,
}
}

appSrvsFiles, err := ioutil.ReadDir(servicesDirectory + "/" + servicePath + "/" + maa.Name())
appServersFiles, err := ioutil.ReadDir(servicesDirectory + "/" + servicePath + "/" + maa.Name())
if err != nil {
return fmt.Errorf("can't read app servers files: %v", err)
}

for _, app := range appSrvsFiles {
for _, app := range appServersFiles {
dat, err := ioutil.ReadFile(servicesDirectory + "/" + servicePath + "/" + maa.Name() + "/" + app.Name())
if err != nil {
return fmt.Errorf("read app server file %v error: %v",
Expand Down

0 comments on commit c0dac4f

Please sign in to comment.