From 73d4d49d557e1a07af1e67aa66f12d22fcdfa131 Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 20 Jul 2016 02:35:20 +0200 Subject: [PATCH] pkg/server: instruction for updating on GCE Fixes #825 Change-Id: I07dd2502816b6351b6ae71be84e98952cda5056c --- pkg/server/status.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/pkg/server/status.go b/pkg/server/status.go index ec743c89f..fef78f282 100644 --- a/pkg/server/status.go +++ b/pkg/server/status.go @@ -18,6 +18,7 @@ package server import ( "encoding/json" + "errors" "fmt" "html" "io" @@ -40,6 +41,8 @@ import ( "camlistore.org/pkg/server/app" "camlistore.org/pkg/types/camtypes" "go4.org/jsonconfig" + + "google.golang.org/cloud/compute/metadata" ) // StatusHandler publishes server status information. @@ -208,6 +211,17 @@ func (sh *StatusHandler) serveStatusJSON(rw http.ResponseWriter, req *http.Reque httputil.ReturnJSON(rw, sh.currentStatus()) } +func (sh *StatusHandler) googleCloudConsole() (string, error) { + if !env.OnGCE() { + return "", errors.New("not on GCE") + } + projID, err := metadata.ProjectID() + if err != nil { + return "", fmt.Errorf("Error getting project ID: %v", err) + } + return "https://console.cloud.google.com/compute/instances?project=" + projID, nil +} + var quotedPrefix = regexp.MustCompile(`[;"]/(\S+?/)[&"]`) func (sh *StatusHandler) serveStatusHTML(rw http.ResponseWriter, req *http.Request) { @@ -243,8 +257,18 @@ func (sh *StatusHandler) serveStatusHTML(rw http.ResponseWriter, req *http.Reque f("") f("

Admin

") - f("
") - f(" reindex
") + f("") f("

Handlers

") f("

As JSON: status.json; and the discovery JSON.

", st.rootPrefix)