mirror of https://github.com/perkeep/perkeep.git
Merge "cmd/camtool reindex-diskpacked: don't panic on high-level conf"
This commit is contained in:
commit
f80d27d934
|
@ -73,7 +73,7 @@ func (c *reindexdpCmd) RunCommand(args []string) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("No 'prefixes' object in low-level (or converted) config file %s", osutil.UserServerConfigPath())
|
return fmt.Errorf("No 'prefixes' object in low-level (or converted) config file %s", osutil.UserServerConfigPath())
|
||||||
}
|
}
|
||||||
paths := []string{}
|
paths, confs := []string{}, []jsonconfig.Obj{}
|
||||||
for prefix, vei := range prefixes {
|
for prefix, vei := range prefixes {
|
||||||
pmap, ok := vei.(map[string]interface{})
|
pmap, ok := vei.(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -103,8 +103,7 @@ func (c *reindexdpCmd) RunCommand(args []string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
paths = append(paths, apath)
|
paths = append(paths, apath)
|
||||||
indexConf = jsonconfig.Obj(aconf["metaIndex"].(map[string]interface{}))
|
confs = append(confs, aconf)
|
||||||
log.Printf("indexConf: %v", indexConf)
|
|
||||||
}
|
}
|
||||||
if len(paths) == 0 {
|
if len(paths) == 0 {
|
||||||
return fmt.Errorf("Server config file %s doesn't specify a disk-packed storage handler.",
|
return fmt.Errorf("Server config file %s doesn't specify a disk-packed storage handler.",
|
||||||
|
@ -117,6 +116,13 @@ func (c *reindexdpCmd) RunCommand(args []string) error {
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return errors.New("no path is given/found")
|
return errors.New("no path is given/found")
|
||||||
}
|
}
|
||||||
|
// If no index is specified, the default will be used (as on the regular path).
|
||||||
|
if mi := confs[0]["metaIndex"]; mi != nil {
|
||||||
|
if mi, ok := mi.(map[string]interface{}); ok {
|
||||||
|
indexConf = jsonconfig.Obj(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Printf("indexConf: %v", indexConf)
|
||||||
|
|
||||||
return diskpacked.Reindex(path, c.overwrite, indexConf)
|
return diskpacked.Reindex(path, c.overwrite, indexConf)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue