Example #1
0
func SSHEnabled(args []string, appFactory app.AppFactory, output io.Writer) error {
	if len(args) != 2 || args[0] != "ssh-enabled" {
		return fmt.Errorf("%s\n%s", "Invalid usage", SSHEnabledUsage)
	}

	app, err := appFactory.Get(args[1])
	if err != nil {
		return err
	}

	fmt.Fprintf(output, "%t", app.EnableSSH)
	return nil
}
Example #2
0
func EnableSSH(args []string, appFactory app.AppFactory) error {
	if len(args) != 2 || args[0] != "enable-ssh" {
		return fmt.Errorf("%s\n%s", "Invalid usage", EnableSSHUsage)
	}

	app, err := appFactory.Get(args[1])
	if err != nil {
		return err
	}

	err = appFactory.SetBool(app, "enable_ssh", true)
	if err != nil {
		return err
	}

	return nil
}
Example #3
0
import (
	"errors"

	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models"
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models/app"
	"github.com/cloudfoundry/cli/plugin"
	"github.com/cloudfoundry/cli/plugin/fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("App", func() {
	var (
		fakeCliConnection *fakes.FakeCliConnection
		curler            models.Curler
		af                app.AppFactory
	)

	BeforeEach(func() {
		fakeCliConnection = &fakes.FakeCliConnection{}
	})

	JustBeforeEach(func() {
		af = app.NewAppFactory(fakeCliConnection, curler)
	})

	Describe("Get", func() {
		Context("when CC returns a valid app guid", func() {
			BeforeEach(func() {
				fakeCliConnection.CliCommandWithoutTerminalOutputStub = func(args ...string) ([]string, error) {