From 9f65407c84265e18d8e5e868592ab97035169bd6 Mon Sep 17 00:00:00 2001 From: David Wu Date: Sun, 10 Mar 2019 23:35:59 -0400 Subject: [PATCH] Updated service creation check from a fixed timeout value to an indefinite loop. This mitigates for service provisioning processes that require user ticket approvals or that it takes a long unknown length of time. --- createServicePush/createServicePush.go | 2 +- serviceCreator/serviceCreator.go | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/createServicePush/createServicePush.go b/createServicePush/createServicePush.go index b8a0129..7848d1f 100644 --- a/createServicePush/createServicePush.go +++ b/createServicePush/createServicePush.go @@ -159,7 +159,7 @@ func (c *CreateServicePush) GetMetadata() plugin.PluginMetadata { Version: plugin.VersionType{ Major: 1, Minor: 3, - Build: 0, + Build: 1, }, MinCliVersion: plugin.VersionType{ Major: 6, diff --git a/serviceCreator/serviceCreator.go b/serviceCreator/serviceCreator.go index ba5c460..080ff37 100644 --- a/serviceCreator/serviceCreator.go +++ b/serviceCreator/serviceCreator.go @@ -5,7 +5,6 @@ import ( "fmt" "net/url" "strings" - "time" "code.cloudfoundry.org/cli/plugin" "github.com/dawu415/CF-CLI-Create-Service-Push-Plugin/serviceManifest" @@ -238,11 +237,10 @@ func (c *ServiceCreator) createService(name, broker, plan, JSONParam, tags strin } // Now wait for the service creation to complete. - // serviceCreationTimeout is in seconds waiting for service to complete - var serviceCreationTimeout = time.Duration(900) * time.Second - startTime := time.Now() - - for time.Duration(time.Since(startTime)) <= serviceCreationTimeout { + // We wait 'infinitely' here because we don't know how long the service + // will take to complete. There exists some service brokers where + // provisioning requires user ticket approval input to complete. + for { service, err := c.cf.GetService(name) if err != nil { return err