Skip to content

Commit

Permalink
Merge pull request #1360 from weaveworks/render-reorg
Browse files Browse the repository at this point in the history
Reorganise the render/ package
  • Loading branch information
paulbellamy committed Apr 22, 2016
2 parents a4e68b9 + cfda4c8 commit f727bd6
Show file tree
Hide file tree
Showing 18 changed files with 1,003 additions and 947 deletions.
24 changes: 15 additions & 9 deletions experimental/fixprobe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/weaveworks/scope/common/xfer"
"github.com/weaveworks/scope/probe/appclient"
"github.com/weaveworks/scope/report"
"github.com/weaveworks/scope/test/fixture"
)

func main() {
Expand All @@ -21,22 +22,27 @@ func main() {
publishInterval = flag.Duration("publish.interval", 1*time.Second, "publish (output) interval")
publishToken = flag.String("publish.token", "fixprobe", "publish token, for if we are talking to the service")
publishID = flag.String("publish.id", "fixprobe", "publisher ID used to identify publishers")
useFixture = flag.Bool("fixture", false, "Use the embedded fixture report.")
)
flag.Parse()

if len(flag.Args()) != 1 {
if len(flag.Args()) != 1 && !*useFixture {
log.Fatal("usage: fixprobe [--args] report.json")
}

b, err := ioutil.ReadFile(flag.Arg(0))
if err != nil {
log.Fatal(err)
}

var fixedReport report.Report
decoder := codec.NewDecoderBytes(b, &codec.JsonHandle{})
if err := decoder.Decode(&fixedReport); err != nil {
log.Fatal(err)
if *useFixture {
fixedReport = fixture.Report
} else {
b, err := ioutil.ReadFile(flag.Arg(0))
if err != nil {
log.Fatal(err)
}

decoder := codec.NewDecoderBytes(b, &codec.JsonHandle{})
if err := decoder.Decode(&fixedReport); err != nil {
log.Fatal(err)
}
}

client, err := appclient.NewAppClient(appclient.ProbeConfig{
Expand Down
Loading

0 comments on commit f727bd6

Please sign in to comment.