Ejemplo n.º 1
0
func (sc *StatusCommand) Status() {
	logger := gull.NewVerboseLogger()
	logger.Info("Checking migration status of environment [%s] on etcd host [%s]", sc.Environment, sc.EtcdHostUrl)
	target := gull.NewEtcdMigrationTarget(sc.EtcdHostUrl, sc.Application, sc.Environment, false, logger)
	status := gull.NewStatus(target)
	err := status.Check()
	if err != nil {
		sc.Logger.Info("An error occurred while checking status: [%+v]\n", err)
		os.Exit(1)
	}
}
Ejemplo n.º 2
0
func (dc *DestroyCommand) Destroy() {
	logger := gull.NewVerboseLogger()
	logger.Info("Destroying environment [%s] on etcd host [%s]", dc.Environment, dc.EtcdHostUrl)
	target := gull.NewEtcdMigrationTarget(dc.EtcdHostUrl, dc.Application, dc.Environment, false, logger)
	destroy := gull.NewDestroy(target)
	err := destroy.Execute()
	if err != nil {
		dc.Logger.Info("An error occurred while deleting the environment: [%+v]\n", err)
		os.Exit(1)
	}
}
Ejemplo n.º 3
0
func (sc *StatusCommand) ParseOptions(context *cli.Context) {
	sc.Logger = gull.NewVerboseLogger()
	sc.Application = context.String("application")
	if sc.Application == "" {
		sc.Logger.Info("application was not found, but is required.")
		os.Exit(1)
	}

	sc.Environment = context.String("environment")
	if sc.Environment == "" {
		sc.Logger.Info("No target environment was provided, using 'default'")
		sc.Environment = "default"
	}

	sc.EtcdHostUrl = context.String("etcdhost")
	if sc.EtcdHostUrl == common.DefaultEtcdServerUrl {
		fmt.Printf("No etcdhost was provided, using [%v]\n", common.DefaultEtcdServerUrl)
	}
}