Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion command/v3/v3_delete_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _ = Describe("v3-delete Command", func() {
fakeActor.DeleteApplicationByNameAndSpaceReturns(v3action.Warnings{"some-warning"}, nil)
})

It("deletes the space", func() {
It("deletes the app", func() {
Expect(executeErr).ToNot(HaveOccurred())

Expect(testUI.Err).To(Say("some-warning"))
Expand Down
2 changes: 1 addition & 1 deletion command/v3/v3_share_service_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type V3ShareServiceCommand struct {
OrgName string `short:"o" required:"false" description:"Org of the other space (Default: targeted org)"`
SpaceName string `short:"s" required:"true" description:"Space to share the service instance into"`
usage interface{} `usage:"cf v3-share-service SERVICE_INSTANCE -s OTHER_SPACE [-o OTHER_ORG]"`
relatedCommands interface{} `related_commands:"bind-service, service, services"`
relatedCommands interface{} `related_commands:"bind-service, service, services, v3-unshare-service"`

UI command.UI
Config command.Config
Expand Down
20 changes: 19 additions & 1 deletion command/v3/v3_unshare_service_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ type V3UnshareServiceCommand struct {
RequiredArgs flag.ServiceInstance `positional-args:"yes"`
OrgName string `short:"o" required:"false" description:"Org of the other space (Default: targeted org)"`
SpaceName string `short:"s" required:"true" description:"Space to unshare the service instance from"`
Force bool `short:"f" description:"Force unshare without confirmation"`
usage interface{} `usage:"cf v3-unshare-service SERVICE_INSTANCE -s OTHER_SPACE [-o OTHER_ORG]"`
relatedCommands interface{} `related_commands:"bind-service, service, services"`
relatedCommands interface{} `related_commands:"bind-service, service, services, v3-share-service"`

UI command.UI
Config command.Config
Expand Down Expand Up @@ -90,6 +91,23 @@ func (cmd V3UnshareServiceCommand) Execute(args []string) error {
orgName = cmd.OrgName
}

if !cmd.Force {
cmd.UI.DisplayWarning("WARNING: Unsharing this service instance will remove any service bindings that exist in any spaces that this instance is shared into. This could cause applications to stop working.\n")

response, promptErr := cmd.UI.DisplayBoolPrompt(false, "Really unshare the service instance?", map[string]interface{}{
"ServiceInstanceName": cmd.RequiredArgs.ServiceInstance,
})

if promptErr != nil {
return promptErr
}

if !response {
cmd.UI.DisplayText("Unshare cancelled")
return nil
}
}

cmd.UI.DisplayTextWithFlavor("Unsharing service instance {{.ServiceInstanceName}} from org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{
"ServiceInstanceName": cmd.RequiredArgs.ServiceInstance,
"OrgName": orgName,
Expand Down
Loading