Skip to content

Commit

Permalink
fix BastionMap, improve log (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
suchen-sci authored Jan 17, 2024
1 parent b20cabd commit b4b23ab
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/easeprobe/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func configNotifiers(notifies []notify.Notify) []notify.Notify {
validNotifies := []notify.Notify{}
for _, n := range notifies {
if err := n.Config(gNotifyConf); err != nil {
log.Errorf("error: %v", err)
log.Errorf("Bad Notify Configuration for notifier %s %s: %v", n.Kind(), n.Name(), err)
continue
}
validNotifies = append(validNotifies, n)
Expand Down
2 changes: 1 addition & 1 deletion cmd/easeprobe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func configProbers(probers []probe.Prober) []probe.Prober {
if err := p.Config(gProbeConf); err != nil {
p.Result().Status = probe.StatusBad
p.Result().Message = "Bad Configuration: " + err.Error()
log.Errorf("Bad Probe Configuration: %v", err)
log.Errorf("Bad Probe Configuration for prober %s %s: %v", p.Kind(), p.Name(), err)
continue
}

Expand Down
1 change: 0 additions & 1 deletion conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ func allProbersHelper(i interface{}) []probe.Prober {
vField := v.Field(i)
for j := 0; j < vField.Len(); j++ {
if !isProbe(vField.Index(j).Addr().Type()) {
//log.Debugf("%s is not a probe type", vField.Index(j).Type())
continue
}

Expand Down
2 changes: 1 addition & 1 deletion conf/constlables.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

// MergeConstLabels merge const labels from all probers.
// Prometheus requires all metric of the same name have the same set of labels in a collector
// Prometheus requires all metric of the same name have the same set of labels in a collector
func MergeConstLabels(ps []probe.Prober) {
var constLabels = make(map[string]bool)
for _, p := range ps {
Expand Down
4 changes: 4 additions & 0 deletions conf/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func mergeYamlFiles(path string) ([]byte, error) {
if err != nil {
return nil, err
}
moreFiles, err := filepath.Glob(filepath.Join(path, "*.yml"))
if err == nil {
files = append(files, moreFiles...)
}

if len(files) <= 0 {
return nil, fmt.Errorf("yaml files not found for %v", path)
Expand Down
2 changes: 1 addition & 1 deletion conf/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func assertMerge(t *testing.T, into, from, expected string) {

err := os.WriteFile(dir+"/config1.yaml", []byte(into), 0755)
assert.Nil(t, err)
err = os.WriteFile(dir+"/config2.yaml", []byte(from), 0755)
err = os.WriteFile(dir+"/config2.yml", []byte(from), 0755)
assert.Nil(t, err)

actual, err := mergeYamlFiles(dir)
Expand Down
4 changes: 0 additions & 4 deletions docs/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,6 @@ websocket:
labels:
service: tts
idc: idc-a
```


Expand Down
2 changes: 1 addition & 1 deletion global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
var (
// Ver is the program version
// It will be set by the build script
// go build -ldflags "-X github.com/megaease/easegress/pkg/global.Ver=1.0.0"
// go build -ldflags "-X github.com/megaease/easeprobe/global.Ver=1.0.0"
Ver = "v1.7.0"
//OrgProg combine organization and program
OrgProg = Org + " " + DefaultProg
Expand Down
2 changes: 1 addition & 1 deletion probe/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (bm *BastionMapType) ParseAllBastionHost() {
err := v.ParseHost()
if err != nil {
log.Errorf("Bastion Host error: [%s / %s] - %v", k, BastionMap[k].Host, err)
delete(BastionMap, k)
delete(*bm, k)
continue
}
(*bm)[k] = v
Expand Down

0 comments on commit b4b23ab

Please sign in to comment.