Exemple #1
0
func (command *commandReboot) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsReboot)
	err := servers.Reboot(command.Context().ServiceClient, params.serverID, params.how).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = fmt.Sprintf("Successfully rebooted instance [%s]\n", params.serverID)
}
Exemple #2
0
func (command *commandReboot) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsReboot)
	serverID := params.serverID
	err := servers.Reboot(command.Context().ServiceClient, serverID, params.how).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}

	if params.wait {
		err = osServers.WaitForStatus(command.Ctx.ServiceClient, serverID, "ACTIVE", 600)
		if err != nil {
			resource.Err = err
			return
		}

		resource.Result = fmt.Sprintf("Rebooted instance [%s]\n", serverID)
	} else {
		resource.Result = fmt.Sprintf("Rebooting instance [%s]\n", serverID)
	}
}