From 76f18842464182865813d670286e45265675b0c9 Mon Sep 17 00:00:00 2001 From: David Wu Date: Tue, 14 Nov 2017 22:46:01 -0600 Subject: [PATCH] Fixed bug where run did not specifically handle create-service-push only. --- Makefile | 2 +- create-services-plugin.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 19d78cd..8609f83 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,6 @@ build: cf: cf uninstall-plugin CreateServicePush || true - cf install-plugin create-services-cliplugin + cf install-plugin CF-CLI-Create-Service-Push-Plugin it: build cf diff --git a/create-services-plugin.go b/create-services-plugin.go index f8b0042..d70c57b 100644 --- a/create-services-plugin.go +++ b/create-services-plugin.go @@ -29,6 +29,10 @@ type CreateServicePush struct { // 1 should the plugin exits nonzero. func (c *CreateServicePush) Run(cliConnection plugin.CliConnection, args []string) { + if args[0] != "create-service-push" { + return + } + // 1. Find an argument of --service-manifest in the list. This will tell us the manifest file var manifestFilename = "services-manifest.yml" var pushApplication = true @@ -52,8 +56,8 @@ func (c *CreateServicePush) Run(cliConnection plugin.CliConnection, args []strin // 2. Whatever the manifest file is, check to make sure it exists! if len(manifestFilename) > 0 { - fmt.Printf("Found ManifestFile: %s\n", manifestFilename) if _, err := os.Stat(manifestFilename); !os.IsNotExist(err) { + fmt.Printf("Found ManifestFile: %s\n", manifestFilename) filePointer, err := os.Open(manifestFilename) if err == nil { manifest, err := ParseManifest(filePointer) @@ -68,11 +72,11 @@ func (c *CreateServicePush) Run(cliConnection plugin.CliConnection, args []strin } createServicesobject.createServices() } else { - fmt.Printf("ERROR: %s\n", err) + fmt.Printf("ERROR: Unable to open %s.\n", manifestFilename) os.Exit(1) } } else { - fmt.Printf("ERROR: %s\n", err) + fmt.Printf("ERROR: The file %s was not found.\n", manifestFilename) os.Exit(1) } }