Пример #1
0
func (command *commandRebuild) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsRebuild)
	opts := params.opts
	serverID := params.serverID
	server, err := servers.Rebuild(command.Ctx.ServiceClient, serverID, opts).Extract()
	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
		}

		server, err = servers.Get(command.Ctx.ServiceClient, serverID).Extract()
		if err != nil {
			resource.Err = err
			return
		}
	}

	resource.Result = serverSingle(server)
}
Пример #2
0
func (command *commandRebuild) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsRebuild).opts
	serverID := resource.Params.(*paramsRebuild).serverID
	server, err := servers.Rebuild(command.Ctx.ServiceClient, serverID, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = serverSingle(server)
}