Exemple #1
0
func NewCliApp() *cli.App {
	config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot())))

	signalChan := make(chan os.Signal)
	signal.Notify(signalChan, os.Interrupt)
	exitHandler := exit_handler.New(signalChan, os.Exit)
	go exitHandler.Run()

	targetVerifier := target_verifier.New(receptor_client_factory.MakeReceptorClient)
	app := cli_app_factory.MakeCliApp(latticeVersion, ltcConfigRoot(), exitHandler, config, logger(), targetVerifier, os.Stdout)
	return app
}
Exemple #2
0
func NewCliApp() *cli.App {
	config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot())))

	signalChan := make(chan os.Signal)
	signal.Notify(signalChan, os.Interrupt)
	exitHandler := exit_handler.New(signalChan, os.Exit)
	go exitHandler.Run()

	receptorClientCreator := receptor_client.ProxyAwareCreator{}

	return cli_app_factory.MakeCliApp(
		diegoVersion,
		latticeVersion,
		ltcConfigRoot(),
		exitHandler,
		config,
		logger(),
		receptorClientCreator,
		target_verifier.New(receptorClientCreator),
		os.Stdout,
	)
}
Exemple #3
0
func NewCliApp() *cli.App {
	config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot())))

	signalChan := make(chan os.Signal)
	signal.Notify(signalChan, os.Interrupt)
	exitHandler := exit_handler.New(signalChan, os.Exit)
	go exitHandler.Run()

	targetVerifier := target_verifier.New(func(target string) receptor.Client {
		return receptor.NewClient(target)
	})

	return cli_app_factory.MakeCliApp(
		diegoVersion,
		latticeVersion,
		ltcConfigRoot(),
		exitHandler,
		config,
		logger(),
		targetVerifier,
		os.Stdout,
	)
}
package config_helpers_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/lattice/ltc/config/config_helpers"
)

var _ = Describe("ConfigHelpers", func() {

	Describe("ConfigFileLocation", func() {
		It("returns the config location for the diego home path", func() {
			fileLocation := config_helpers.ConfigFileLocation("/home/chicago")
			Expect(fileLocation).To(Equal("/home/chicago/.lattice/config.json"))
		})
	})
})
				ghttp.VerifyRequest("GET", "/v1/actual_lrps"),
				ghttp.RespondWithJSONEncoded(http.StatusOK, actualResponse),
			),
		)
		fakeServer.RouteToHandler("GET", "/v1/tasks",
			ghttp.CombineHandlers(
				ghttp.VerifyRequest("GET", "/v1/tasks"),
				ghttp.RespondWithJSONEncoded(http.StatusOK, tasksResponse),
			),
		)

		var err error
		configRoot, err = ioutil.TempDir("", "config")
		Expect(err).NotTo(HaveOccurred())

		ltcConfig := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(configRoot)))

		listenerHost, listenerPort, err = net.SplitHostPort(listenerAddr)
		Expect(err).NotTo(HaveOccurred())
		ltcConfig.SetTarget(fmt.Sprintf("%s.xip.io:%s", listenerHost, listenerPort))
		Expect(ltcConfig.Save()).To(Succeed())

		os.Setenv(latticeCliHomeVar, configRoot)
	})
	AfterEach(func() {
		fakeServer.Close()
		Expect(os.RemoveAll(configRoot)).To(Succeed())
		Expect(os.Unsetenv(latticeCliHomeVar)).To(Succeed())
	})

	ltcCommand := func(args ...string) *exec.Cmd {