8 // EvalRefresh is an EvalNode implementation that does a refresh for
10 type EvalRefresh struct {
11 Provider *ResourceProvider
14 Output **InstanceState
18 func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
19 provider := *n.Provider
22 // If we have no state, we don't do any refreshing
24 log.Printf("[DEBUG] refresh: %s: no state, not refreshing", n.Info.Id)
28 // Call pre-refresh hook
29 err := ctx.Hook(func(h Hook) (HookAction, error) {
30 return h.PreRefresh(n.Info, state)
37 state, err = provider.Refresh(n.Info, state)
39 return nil, fmt.Errorf("%s: %s", n.Info.Id, err.Error())
42 // Call post-refresh hook
43 err = ctx.Hook(func(h Hook) (HookAction, error) {
44 return h.PostRefresh(n.Info, state)