Beispiel #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
}
Beispiel #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
}
Beispiel #3
0
			Context("when an App is returned", func() {
				BeforeEach(func() {
					curler = func(cli plugin.CliConnection, result interface{}, args ...string) error {
						a, ok := result.(*app.CFApp)
						Expect(ok).To(BeTrue())
						a.Metadata.Guid = "app1-guid"
						a.Entity.EnableSSH = true
						a.Entity.Diego = true
						a.Entity.State = "STARTED"
						return nil
					}
				})

				It("returns a populated App model", func() {
					model, err := af.Get("app1")

					Expect(err).NotTo(HaveOccurred())
					Expect(model.Guid).To(Equal("app1-guid"))
					Expect(model.EnableSSH).To(BeTrue())
					Expect(model.Diego).To(BeTrue())
					Expect(model.State).To(Equal("STARTED"))
				})
			})

			Context("when curling the App fails", func() {
				BeforeEach(func() {
					curler = func(cli plugin.CliConnection, result interface{}, args ...string) error {
						return errors.New("not good")
					}
				})