Skip to content

Commit

Permalink
Fixed bug where run did not specifically handle create-service-push o…
Browse files Browse the repository at this point in the history
…nly.
  • Loading branch information
David Wu committed Nov 15, 2017
1 parent ab8158d commit 76f1884
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 7 additions & 3 deletions create-services-plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 76f1884

Please sign in to comment.