示例#1
0
func main() {
	app := boshapp.New()
	err := app.Run(os.Args)

	if err != nil {
		fmt.Fprintf(os.Stderr, err.Error()+"\n")
		os.Exit(1)
	}
}
示例#2
0
文件: agent.go 项目: nicregez/bosh
func main() {
	app := boshapp.New()
	err := app.Run(os.Args)

	if err != nil {
		logger.Error("Main", err.Error())
		os.Exit(1)
	}
}
示例#3
0
func main() {
	logger := boshlog.NewLogger(boshlog.LEVEL_DEBUG)
	defer logger.HandlePanic("Main")

	app := boshapp.New(logger)
	err := app.Run(os.Args)

	if err != nil {
		logger.Error("Main", err.Error())
		os.Exit(1)
	}
}
示例#4
0
func main() {
	logger := boshlog.NewLogger(boshlog.LEVEL_DEBUG)
	defer logger.HandlePanic("Main")
	logger.Debug("main", "Starting agent")

	app := boshapp.New(logger)
	app.Setup(os.Args)
	err := app.Run()

	if err != nil {
		logger.Error("Main", err.Error())
		os.Exit(1)
	}
}
示例#5
0
func main() {
	logger := boshlog.NewLogger(boshlog.LevelDebug)
	defer logger.HandlePanic("Main")

	logger.Debug(mainLogTag, "Starting agent")

	app := boshapp.New(logger)

	err := app.Setup(os.Args)
	if err != nil {
		logger.Error(mainLogTag, "App setup %s", err.Error())
		os.Exit(1)
	}

	err = app.Run()
	if err != nil {
		logger.Error(mainLogTag, "App run %s", err.Error())
		os.Exit(1)
	}
}
示例#6
0
func init() {
	Describe("App", func() {
		var baseDir string

		BeforeEach(func() {
			baseDir, _ = ioutil.TempDir("", "go-agent-test")
			os.Mkdir(filepath.Join(baseDir, "bosh"), os.ModePerm)
			settingsPath := filepath.Join(baseDir, "bosh", "settings.json")

			settingsJSON := `{
					"agent_id": "my-agent-id",
					"blobstore": {
						"options": {
							"bucket_name": "george",
							"encryption_key": "optional encryption key",
							"access_key_id": "optional access key id",
							"secret_access_key": "optional secret access key"
						},
						"provider": "dummy"
					},
					"disks": {
						"ephemeral": "/dev/sdb",
						"persistent": {
							"vol-xxxxxx": "/dev/sdf"
						},
						"system": "/dev/sda1"
					},
					"env": {
						"bosh": {
							"password": "******"
						}
					},
					"networks": {
						"netA": {
							"default": ["dns", "gateway"],
							"ip": "ww.ww.ww.ww",
							"dns": [
								"xx.xx.xx.xx",
								"yy.yy.yy.yy"
							]
						},
						"netB": {
							"dns": [
								"zz.zz.zz.zz"
							]
						}
					},
					"Mbus": "https://*****:*****@0.0.0.0:6868",
					"ntp": [
						"0.north-america.pool.ntp.org",
						"1.north-america.pool.ntp.org"
					],
					"vm": {
						"name": "vm-abc-def"
					}
				}`

			ioutil.WriteFile(settingsPath, []byte(settingsJSON), 0640)
		})

		AfterEach(func() {
			os.RemoveAll(baseDir)
		})

		It("Sets up device path resolver on platform specific to infrastructure", func() {
			logger := boshlog.NewLogger(boshlog.LevelNone)
			app := boshapp.New(logger)

			err := app.Setup([]string{
				"bosh-agent",
				"-I", "dummy",
				"-P", "dummy",
				"-b", baseDir,
			})

			Expect(err).ToNot(HaveOccurred())

			Expect(app.GetPlatform().GetDevicePathResolver()).To(Equal(app.GetInfrastructure().GetDevicePathResolver()))
		})
	})
}