(client models.Client, path string)
| 124 | } |
| 125 | |
| 126 | func (t *cmdAdmin) dumpConfigV1Recursively(client models.Client, path string) interface{} { |
| 127 | files, err := client.List(path, false) |
| 128 | if err != nil { |
| 129 | log.PanicErrorf(err, "list path = %s failed", path) |
| 130 | } |
| 131 | if len(files) != 0 { |
| 132 | var m = make(map[string]interface{}) |
| 133 | for _, path := range files { |
| 134 | m[filepath.Base(path)] = t.dumpConfigV1Recursively(client, path) |
| 135 | } |
| 136 | return m |
| 137 | } |
| 138 | b, err := client.Read(path, false) |
| 139 | if err != nil { |
| 140 | log.PanicErrorf(err, "read file = %s failed", path) |
| 141 | } |
| 142 | if len(b) != 0 { |
| 143 | var v interface{} |
| 144 | if err := json.Unmarshal(b, &v); err != nil { |
| 145 | log.PanicErrorf(err, "json unmarshal failed") |
| 146 | } |
| 147 | return v |
| 148 | } |
| 149 | return nil |
| 150 | } |
| 151 | |
| 152 | func (t *cmdAdmin) dumpConfigV3(d map[string]interface{}) { |
| 153 | store := t.newTopomStore(d) |
no test coverage detected