Restore --format table support

* system df
* events
  * fix error handling from go routine
  * update tests to use gomega matchers for better error messages
* system info
* version
* volume inspect

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2020-10-09 09:13:22 -07:00
parent 7ad631b819
commit eb4a746efc
14 changed files with 166 additions and 412 deletions

View File

@ -112,11 +112,15 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
errorChannel <- runtime.Events(r.Context(), readOpts)
}()
var flush = func() {}
if flusher, ok := w.(http.Flusher); ok {
flush = flusher.Flush
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
}
flush()
coder := json.NewEncoder(w)
coder.SetEscapeHTML(true)
@ -124,6 +128,7 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
select {
case err := <-errorChannel:
if err != nil {
// FIXME StatusOK already sent above cannot send 500 here
utils.InternalServerError(w, err)
return
}
@ -136,9 +141,7 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
if err := coder.Encode(e); err != nil {
logrus.Errorf("unable to write json: %q", err)
}
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
}
flush()
case <-r.Context().Done():
return
}