Skip to content

Commit

Permalink
feat: add tip to restart app when enabling ssh (#2314)
Browse files Browse the repository at this point in the history
* add tip to restart app when enabling ssh

* adjust according to style guide
  • Loading branch information
wanddynosios committed Oct 12, 2023
1 parent 8224c92 commit 6c371aa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions command/v7/enable_ssh_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,14 @@ func (cmd *EnableSSHCommand) Execute(args []string) error {
cmd.UI.DisplayText("TIP: Ensure ssh is also enabled on the space and global level.")
}

if sshEnabled.Enabled && !appFeature.Enabled {
cmd.UI.DisplayText("TIP: An app restart is required for the change to take effect.")
}

if appFeature.Enabled {
cmd.UI.DisplayText("TIP: An app restart may be required for the change to take effect.")
}

return nil
}

2 changes: 2 additions & 0 deletions command/v7/enable_ssh_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ var _ = Describe("enable-ssh Command", func() {
Expect(testUI.Err).To(Say("some-get-ssh-enabled-warnings"))
Expect(testUI.Out).To(Say(`Enabling ssh support for app %s as %s\.\.\.`, appName, currentUserName))
Expect(testUI.Out).To(Say("OK"))
Expect(testUI.Out).To(Say("TIP: An app restart is required for the change to take effect."))
})

When("SSH is disabled at a level above the app level", func() {
Expand Down Expand Up @@ -160,6 +161,7 @@ var _ = Describe("enable-ssh Command", func() {
It("shows the app ssh is already enabled", func() {
Expect(testUI.Out).To(Say("ssh support for app 'some-app' is already enabled."))
Expect(testUI.Out).To(Say("OK"))
Expect(testUI.Out).To(Say("TIP: An app restart may be required for the change to take effect."))
})
})

Expand Down
2 changes: 2 additions & 0 deletions integration/v7/isolated/enable_ssh_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var _ = Describe("enable-ssh command", func() {
Eventually(session).Should(Say(`Enabling ssh support for app %s as %s\.\.\.`, appName, userName))

Eventually(session).Should(Say("OK"))
Eventually(session).Should(Say("TIP: An app restart is required for the change to take effect."))
Eventually(session).Should(Exit(0))

session = helpers.CF("curl", fmt.Sprintf("v3/apps/%s/ssh_enabled", helpers.AppGUID(appName)))
Expand All @@ -125,6 +126,7 @@ var _ = Describe("enable-ssh command", func() {

Eventually(session).Should(Say("ssh support for app '%s' is already enabled.", appName))
Eventually(session).Should(Say("OK"))
Eventually(session).Should(Say("An app restart may be required for the change to take effect."))

session = helpers.CF("curl", fmt.Sprintf("v3/apps/%s/ssh_enabled", helpers.AppGUID(appName)))
Eventually(session).Should(Exit(0))
Expand Down

0 comments on commit 6c371aa

Please sign in to comment.