From c57c8773a60bf3cfb32afb802c193b888ebf38d7 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Mon, 7 Jan 2019 19:12:02 -0700 Subject: [PATCH] Wait until app is installed to print notes Fixes cli timeout when installing app without a NOTES.txt file. --- cmd/app.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/app.go b/cmd/app.go index f940a543..dfb3b96b 100644 --- a/cmd/app.go +++ b/cmd/app.go @@ -601,11 +601,14 @@ func templateInstall(ctx *cli.Context) error { return err } - // wait for the app's notes to be populated so we can print them - var timeout int - for len(madeApp.Notes) == 0 { + // wait for the app to be installed to print the notes + var ( + timeout int + installed bool + ) + for !installed { if timeout == 60 { - return errors.New("timed out waiting for app notes, the app could still be installing. Run 'rancher apps' to verify") + return errors.New("timed out waiting for app to install. Run 'rancher apps' to verify status") } timeout++ time.Sleep(2 * time.Second) @@ -613,6 +616,14 @@ func templateInstall(ctx *cli.Context) error { if err != nil { return err } + for _, condition := range madeApp.Conditions { + condType := strings.ToLower(condition.Type) + condStatus := strings.ToLower(condition.Status) + if condType == "installed" && condStatus == "true" { + installed = true + break + } + } } if len(madeApp.Notes) != 0 {