veyron/tools/principal: Complain about missing VEYRON_CREDENTIALS
earlier in the seekblessings flow (before talking to any web
services).
Change-Id: I47ab4b4d4c11f16766bba766f58f1e8c66fb0e29
diff --git a/tools/principal/main.go b/tools/principal/main.go
index add120f..ded8117 100644
--- a/tools/principal/main.go
+++ b/tools/principal/main.go
@@ -400,6 +400,12 @@
specific peer pattern is provided using the --for_peer flag.
`,
Run: func(cmd *cmdline.Command, args []string) error {
+ // Initialize the runtime first so that any local errors are reported
+ // before the HTTP roundtrips for obtaining the macaroon begin.
+ r, err := runtime()
+ if err != nil {
+ return err
+ }
blessedChan := make(chan string)
defer close(blessedChan)
macaroonChan, err := getMacaroonForBlessRPC(flagSeekBlessingsFrom, blessedChan)
@@ -408,11 +414,6 @@
}
macaroon := <-macaroonChan
service := <-macaroonChan
-
- r, err := runtime()
- if err != nil {
- return err
- }
ctx, cancel := r.NewContext().WithTimeout(time.Minute)
defer cancel()