Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Handle ltc create condition where cannot determine start command.
Browse files Browse the repository at this point in the history
[Fixes #90207888]

Signed-off-by: David Wadden <[email protected]>
  • Loading branch information
chelseatroy committed Mar 12, 2015
1 parent b77b0ee commit 8d9823a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ltc/app_runner/command_factory/app_runner_command_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,14 @@ func (factory *AppRunnerCommandFactory) createApp(context *cli.Context) {
}

if startCommand == "" {
factory.output.Say("No start command specified, using start command from the image metadata...\n")
if len(imageMetadata.StartCommand) == 0 {
factory.output.SayLine("Unable to determine start command from image metadata.")
return
}

factory.output.Say("No start command specified, using start command from the image metadata...\n")
startCommand = imageMetadata.StartCommand[0]

factory.output.Say("Start command is:\n")
factory.output.Say(strings.Join(imageMetadata.StartCommand, " ") + "\n")

Expand Down
12 changes: 12 additions & 0 deletions ltc/app_runner/command_factory/app_runner_command_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,18 @@ var _ = Describe("CommandFactory", func() {
test_helpers.ExecuteCommandWithArgs(createCommand, args)

Expect(outputBuffer).ToNot(test_helpers.Say("Working directory is:"))
Expect(appRunner.CreateDockerAppCallCount()).To(Equal(1))
})

Context("when the metadata also has no start command", func() {
It("outputs an error message and exits", func() {
dockerMetadataFetcher.FetchMetadataReturns(&docker_metadata_fetcher.ImageMetadata{}, nil)

test_helpers.ExecuteCommandWithArgs(createCommand, args)

Expect(outputBuffer).To(test_helpers.Say("Unable to determine start command from image metadata.\n"))
Expect(appRunner.CreateDockerAppCallCount()).To(BeZero())
})
})
})

Expand Down

0 comments on commit 8d9823a

Please sign in to comment.