コード例 #1
0
ファイル: boshlite.go プロジェクト: Kaixiang/bosh-lite-cli
func main() {
	app := cli.NewApp()
	app.Name = "bosh-lite"
	app.Usage = "A command line tool to facilitate using Bosh-Lite deployment"
	app.Version = "1.0.0.alpha"
	app.Commands = []cli.Command{
		{
			Name:      "add-route",
			ShortName: "ar",
			Usage:     "add a system route to access the bosh-lite deployed vms",
			Action: func(c *cli.Context) {
				config := configuration.Default()

				fmt.Printf("Adding route for %s through Bosh lite gateway: %s \n",
					termcolor.Colorize(config.IpRange, termcolor.Yellow, true),
					termcolor.Colorize(config.Gateway, termcolor.Cyan, true))

				util.Addroute(config)
			},
		},
		{
			Name:      "check-version",
			ShortName: "cv",
			Usage:     "check all the software required for running bosh-lite and give suggestions",
			Action: func(c *cli.Context) {
				fmt.Printf("%s\n", termcolor.Colorize("Start Checking all your installed software", termcolor.Green, true))
				util.SoftCheck()
			},
		},
		{
			Name:      "generate-manifest",
			ShortName: "gm",
			Usage:     "generate and setup bosh lite manifest(target your bosh-lite director before use this)",
			Action: func(c *cli.Context) {
				fmt.Printf("%s\n", termcolor.Colorize("Start setting up bosh-lite manifest", termcolor.Green, true))
				util.SetupManifest()
			},
		},
	}
	app.Run(os.Args)
}
コード例 #2
0
ファイル: util_test.go プロジェクト: Kaixiang/bosh-lite-cli
func TestRouteCmd(t *testing.T) {
	config := configuration.Default()
	cmd := RouteCmd(config)
	assert.Equal(t, cmd, "route delete -net 10.244.0.0/19 192.168.50.4 > /dev/null 2>&1;route add -net 10.244.0.0/19 192.168.50.4")
}