Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
exit if index-rules couldn't be found
Browse files Browse the repository at this point in the history
  • Loading branch information
replay committed Mar 7, 2019
1 parent ef2aa81 commit fb1d7ab
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmd/mt-index-prune/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func main() {
cassI = i
}
}

if cassI == 0 {
log.Println("only indextype 'cass' supported")
flag.Usage()
Expand All @@ -95,14 +96,14 @@ func main() {

indexRules, err := conf.ReadIndexRules(indexRulesFile)
if os.IsNotExist(err) {
log.Fatalf("Index-rules.conf file %s does not exist; using defaults", indexRulesFile)
log.Fatalf("Index-rules.conf file %s does not exist; exiting", indexRulesFile)
os.Exit(1)
}
now := time.Now()
cutoffs := indexRules.Cutoffs(now)

cassFlags.Parse(os.Args[cassI+1:])
cassandra.CliConfig.Enabled = true

cassIdx := cassandra.New(cassandra.CliConfig)
err = cassIdx.InitBare()
perror(err)
Expand Down Expand Up @@ -160,9 +161,7 @@ func main() {

if noDryRun {
err = cassIdx.ArchiveDefs(deprecatedDefs)
if err != nil {
perror(fmt.Errorf("Failed to archive defs: %s", err.Error()))
}
perror(fmt.Errorf("Failed to archive defs: %s", err.Error()))
}

defs = defs[:0]
Expand Down

0 comments on commit fb1d7ab

Please sign in to comment.