@@ -95,21 +95,19 @@ type withmanager interface {
9595}
9696
9797type withDryRun interface {
98- DryRun () error
98+ DryRun () error
9999}
100100
101101// In-phase hooks for phases to run logic immediately before/after Run().
102102// These are strictly internal hooks for phases themselves and are separate
103103// from user-configured lifecycle hooks handled by the RunHooks phase.
104104type withBefore interface {
105- Before () error
105+ Before () error
106106}
107107type withAfter interface {
108- After () error
108+ After () error
109109}
110110
111-
112-
113111// Manager executes phases to construct the cluster
114112type Manager struct {
115113 phases Phases
@@ -247,14 +245,14 @@ func (m *Manager) Run(ctx context.Context) error {
247245 }
248246 }
249247
250- // Run in-phase before hook if implemented.
251- if bp , ok := p .(withBefore ); ok {
252- log .Debugf ("running before for phase '%s'" , p .Title ())
253- if err := bp .Before (); err != nil {
254- log .Debugf ("before failed '%s'" , err .Error ())
255- return err
256- }
257- }
248+ // Run in-phase before hook if implemented.
249+ if bp , ok := p .(withBefore ); ok {
250+ log .Debugf ("running before for phase '%s'" , p .Title ())
251+ if err := bp .Before (); err != nil {
252+ log .Debugf ("before failed '%s'" , err .Error ())
253+ return err
254+ }
255+ }
258256
259257 text := Colorize .Green ("==> Running phase: %s" ).String ()
260258 log .Infof (text , title )
@@ -266,24 +264,24 @@ func (m *Manager) Run(ctx context.Context) error {
266264 continue
267265 }
268266
269- result = p .Run (ctx )
270- ran = append (ran , p )
271-
272- // Only run in-phase After hook if Run() succeeded.
273- // If After() fails after a successful Run(), return the After() error.
274- if result == nil {
275- if ap , ok := p .(withAfter ); ok {
276- log .Debugf ("running after for phase '%s'" , p .Title ())
277- if herr := ap .After (); herr != nil {
278- return herr
279- }
280- }
281- }
282-
283- if result != nil {
284- return result
285- }
286- }
267+ result = p .Run (ctx )
268+ ran = append (ran , p )
269+
270+ // Only run in-phase After hook if Run() succeeded.
271+ // If After() fails after a successful Run(), return the After() error.
272+ if result == nil {
273+ if ap , ok := p .(withAfter ); ok {
274+ log .Debugf ("running after for phase '%s'" , p .Title ())
275+ if herr := ap .After (); herr != nil {
276+ return herr
277+ }
278+ }
279+ }
280+
281+ if result != nil {
282+ return result
283+ }
284+ }
287285
288286 return nil
289287}
0 commit comments