Skip to content

Commit 1e08c39

Browse files
committed
#190 headless broken.
1 parent ab2fc0f commit 1e08c39

File tree

5 files changed

+49
-22
lines changed

5 files changed

+49
-22
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.0.9
1+
v3.0.9_dev2

cmd/glcon/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import (
88
var VERSION string
99

1010
func main() {
11-
log.Info("version: ", VERSION)
11+
log.Print("version: ", VERSION)
1212
cli.Execute()
1313
}

internal/summoner/acquire/headlessNG.go

+7-20
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ func PageRenderAndUpload(v1 *viper.Viper, mc *minio.Client, timeout time.Duratio
164164

165165
jsonlds, err := PageRender(v1, timeout, url, k, repologger, repoStats)
166166

167-
if err != nil { // from page render
167+
if err == nil { // from page render. If there are no errros, upload.
168168
if len(jsonlds) > 1 {
169-
repologger.WithFields(log.Fields{"url": url, "issue": "Multiple JSON"}).Debug(err)
169+
log.WithFields(log.Fields{"url": url, "issue": "Multiple JSON"}).Info("Error uploading jsonld to object store:", url)
170+
repologger.WithFields(log.Fields{"url": url, "issue": "Multiple JSON"}).Debug()
170171
}
171172
for _, jsonld := range jsonlds {
172173
sha, err := Upload(v1, mc, bucketName, k, url, jsonld)
@@ -175,6 +176,7 @@ func PageRenderAndUpload(v1 *viper.Viper, mc *minio.Client, timeout time.Duratio
175176
repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Error uploading jsonld to object store"}).Error(err)
176177
repoStats.Inc(common.StoreError)
177178
} else {
179+
log.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Uploaded JSONLD to object store"}).Info("Uploaded JSONLD to object store:", url, err, sha)
178180
repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Uploaded JSONLD to object store"}).Debug()
179181
repoStats.Inc(common.Stored)
180182
}
@@ -198,6 +200,7 @@ func PageRender(v1 *viper.Viper, timeout time.Duration, url, k string, repologge
198200
sources, err := configTypes.GetSources(v1)
199201
source, err := configTypes.GetSourceByName(sources, k)
200202
headlessWait := source.HeadlessWait
203+
201204
if timeout*time.Duration(retries) < time.Duration(headlessWait)*time.Second {
202205
timeout = time.Duration(headlessWait) * time.Second
203206
}
@@ -389,24 +392,8 @@ func PageRender(v1 *viper.Viper, timeout time.Duration, url, k string, repologge
389392
} else if valid && jsonld != "" { // traps out the root domain... should do this different
390393
response = append(response, jsonld)
391394
err = nil
392-
//sha, err := Upload(v1, mc, bucketName, k, url, jsonld)
393-
//if err != nil {
394-
// log.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Error uploading jsonld to object store"}).Error("Error uploading jsonld to object store:", url, err, sha)
395-
// repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Error uploading jsonld to object store"}).Error(err)
396-
// repoStats.Inc(common.StoreError)
397-
//} else {
398-
// repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Uploaded JSONLD to object store"}).Debug()
399-
// repoStats.Inc(common.Stored)
400-
//}
401-
//// TODO Is here where to add an entry to the KV store
402-
//err = db.Update(func(tx *bolt.Tx) error {
403-
// b := tx.Bucket([]byte(k))
404-
// err := b.Put([]byte(url), []byte(sha))
405-
// if err != nil {
406-
// log.Error("Error writing to bolt", err)
407-
// }
408-
// return nil
409-
//})
395+
// need to just return a list
396+
410397
} else {
411398
// there could be one bad jsonld, and one good. We want to process the jsonld
412399
// so, do not set an err

internal/summoner/summoner.go

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func Summoner(mc *minio.Client, v1 *viper.Viper, db *bolt.DB) {
7070
}
7171
// just report the error, and then run gathered urls
7272
if len(hru) > 0 {
73+
log.Info("running headless:")
7374
acquire.HeadlessNG(v1, mc, hru, db, runStats)
7475
}
7576

pkg/cli/version.go

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package cli
2+
3+
import (
4+
log "github.com/sirupsen/logrus"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
// gleanerCmd represents the run command
9+
var versionCmd = &cobra.Command{
10+
Use: "version",
11+
TraverseChildren: true,
12+
Short: "returns version ",
13+
Long: `returns version
14+
`, PersistentPreRun: func(cmd *cobra.Command, args []string) {
15+
initGleanerConfig()
16+
},
17+
Run: func(cmd *cobra.Command, args []string) {
18+
log.Info("gleaner called")
19+
log.Info("gleaner called")
20+
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(versionCmd)
26+
// Here you will define your flags and configuration settings.
27+
28+
// Cobra supports Persistent Flags which will work for this command
29+
// and all subcommands, e.g.:
30+
// gleanerCmd.PersistentFlags().String("foo", "", "A help for foo")
31+
32+
// Cobra supports local flags which will only run when this command
33+
// is called directly, e.g.:
34+
// gleanerCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
35+
}
36+
37+
func returnVersion() {
38+
log.Println("Version")
39+
}

0 commit comments

Comments
 (0)