mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
use nested map
This commit is contained in:
parent
2dfcf48ac7
commit
9583f996cf
2 changed files with 7 additions and 4 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.4.1
|
||||
1.4.2
|
||||
|
|
|
@ -54,12 +54,13 @@ func RunAndParse(cmd string, parser func([]byte) Parsed) (Parsed, bool) {
|
|||
|
||||
func Status() (Parsed, bool) {
|
||||
birdStatus, ok := RunAndParse("status", parseStatus)
|
||||
status := birdStatus["status"].(map[string]interface{})
|
||||
|
||||
// Last Reconfig Timestamp source:
|
||||
var lastReconfig string
|
||||
switch StatusConf.ReconfigTimestampSource {
|
||||
case "bird":
|
||||
lastReconfig = birdStatus["last_reconfig"].(string)
|
||||
lastReconfig = status["last_reconfig"].(string)
|
||||
break
|
||||
case "config_modified":
|
||||
lastReconfig = lastReconfigTimestampFromFileStat(
|
||||
|
@ -72,13 +73,15 @@ func Status() (Parsed, bool) {
|
|||
)
|
||||
}
|
||||
|
||||
birdStatus["last_reconfig"] = lastReconfig
|
||||
status["last_reconfig"] = lastReconfig
|
||||
|
||||
// Filter fields
|
||||
for _, field := range StatusConf.FilterFields {
|
||||
birdStatus[field] = nil
|
||||
status[field] = nil
|
||||
}
|
||||
|
||||
birdStatus["status"] = status
|
||||
|
||||
return birdStatus, ok
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue