Exemple #1
0
}

var createMachine = action.Action{
	Name: "create-machine",
	Forward: func(ctx action.FWContext) (action.Result, error) {
		args := ctx.Params[0].(runMachineActionsArgs)
		fmt.Fprintf(args.writer, "  create machine for box (%s)\n", args.box.GetFullName())
		mach := machine.Machine{
			Id:        args.box.Id,
			CartonId:  args.box.CartonId,
			CartonsId: args.box.CartonsId,
			Level:     args.box.Level,
			Name:      args.box.GetFullName(),
			SSH:       args.box.SSH,
		}
		mach.Status = constants.StatusBootstrapping
		return mach, nil
	},
	Backward: func(ctx action.BWContext) {},
}

var updateIpsInRiak = action.Action{
	Name: "update-ips-riak",
	Forward: func(ctx action.FWContext) (action.Result, error) {
		mach := ctx.Previous.(machine.Machine)
		args := ctx.Params[0].(runMachineActionsArgs)
		fmt.Fprintf(args.writer, "  update ips for box (%s)\n", args.box.GetFullName())

		err := mach.FindAndSetIps()
		if err != nil {
			fmt.Fprintf(args.writer, "  update ips for box failed\n%s\n", err.Error())
Exemple #2
0
}

var createMachine = action.Action{
	Name: "create-machine",
	Forward: func(ctx action.FWContext) (action.Result, error) {
		args := ctx.Params[0].(runMachineActionsArgs)
		fmt.Fprintf(args.writer, lb.W(lb.VM_DEPLOY, lb.INFO, fmt.Sprintf("  create machine for box (%s)\n", args.box.GetFullName())))
		mach := machine.Machine{
			Id:        args.box.Id,
			CartonId:  args.box.CartonId,
			CartonsId: args.box.CartonsId,
			Level:     args.box.Level,
			Name:      args.box.GetFullName(),
			SSH:       args.box.SSH,
		}
		mach.Status = constants.StatusIpsUpdating
		return mach, nil
	},
	Backward: func(ctx action.BWContext) {},
}

var updateIpsInSyclla = action.Action{
	Name: "update-ips-scylla",
	Forward: func(ctx action.FWContext) (action.Result, error) {
		mach := ctx.Previous.(machine.Machine)
		args := ctx.Params[0].(runMachineActionsArgs)
		fmt.Fprintf(args.writer, lb.W(lb.VM_DEPLOY, lb.INFO, fmt.Sprintf("  update ips for box (%s)\n", args.box.GetFullName())))
		err := mach.FindAndSetIps()
		if err != nil {
			fmt.Fprintf(args.writer, lb.W(lb.VM_DEPLOY, lb.ERROR, fmt.Sprintf("  update ips for box failed\n%s\n", err.Error())))
			return nil, err