@@ -51,10 +51,10 @@ const (
5151)
5252
5353const (
54- afterInstallStage = "after -install"
55- afterResetStage = "after -reset"
56- // Used in after -{install|reset} stages
57- elementalAfterHook = "elemental-after -hook.yaml"
54+ beforeInstallStage = "before -install"
55+ beforeResetStage = "before -reset"
56+ // Used in before -{install|reset} stages
57+ elementalBeforeHook = "elemental-before -hook.yaml"
5858
5959 // Deterministic Elemental yip paths
6060 registrationConfigPath = "elemental-registration.yaml"
@@ -109,8 +109,8 @@ func (i *installer) InstallElemental(config elementalv1.Config, state register.S
109109 log .Warningf ("Both device and device-selector set, using device-field '%s'" , config .Elemental .Install .Device )
110110 }
111111
112- if err := i .writeAfterHookConfigurator ( afterInstallStage , installOEMMount , config , state , networkConfig ); err != nil {
113- return fmt .Errorf ("writing %s configurator: %w" , afterInstallStage , err )
112+ if err := i .writeHookConfigurator ( beforeInstallStage , installOEMMount , config , state , networkConfig ); err != nil {
113+ return fmt .Errorf ("writing %s configurator: %w" , beforeInstallStage , err )
114114 }
115115
116116 if err := i .runner .Install (config .Elemental .Install ); err != nil {
@@ -126,8 +126,8 @@ func (i *installer) ResetElemental(config elementalv1.Config, state register.Sta
126126 config .Elemental .Reset .ConfigURLs = []string {}
127127 }
128128
129- if err := i .writeAfterHookConfigurator ( afterResetStage , resetOEMMount , config , state , networkConfig ); err != nil {
130- return fmt .Errorf ("writing %s configurator: %w" , afterResetStage , err )
129+ if err := i .writeHookConfigurator ( beforeResetStage , resetOEMMount , config , state , networkConfig ); err != nil {
130+ return fmt .Errorf ("writing %s configurator: %w" , beforeResetStage , err )
131131 }
132132
133133 if err := i .runner .Reset (config .Elemental .Reset ); err != nil {
@@ -242,7 +242,7 @@ func matchesGt(disk *block.Disk, req elementalv1.DeviceSelectorRequirement) (boo
242242 return diskSize .Cmp (keySize ) == 1 , nil
243243}
244244
245- func (i * installer ) writeAfterHookConfigurator (stage string , oemMount string , config elementalv1.Config , state register.State , networkConfig elementalv1.NetworkConfig ) error {
245+ func (i * installer ) writeHookConfigurator (stage string , oemMount string , config elementalv1.Config , state register.State , networkConfig elementalv1.NetworkConfig ) error {
246246 afterHookConfigurator := schema.YipConfig {}
247247 afterHookConfigurator .Name = "Elemental Finalize System"
248248 afterHookConfigurator .Stages = map [string ][]schema.Stage {
@@ -254,31 +254,31 @@ func (i *installer) writeAfterHookConfigurator(stage string, oemMount string, co
254254 if err != nil {
255255 return fmt .Errorf ("getting registration config yip: %w" , err )
256256 }
257- registrationYip := yipAfterHookWrap (string (registrationYipBytes ), filepath .Join (oemMount , registrationConfigPath ), "Registration Config" )
257+ registrationYip := yipHookWrap (string (registrationYipBytes ), filepath .Join (oemMount , registrationConfigPath ), "Registration Config" )
258258 afterHookConfigurator .Stages [stage ] = append (afterHookConfigurator .Stages [stage ], registrationYip )
259259
260260 // State
261261 stateYipBytes , err := i .registrationStateYip (state )
262262 if err != nil {
263263 return fmt .Errorf ("getting registration state config yip: %w" , err )
264264 }
265- stateYip := yipAfterHookWrap (string (stateYipBytes ), filepath .Join (oemMount , stateConfigPath ), "Registration State Config" )
265+ stateYip := yipHookWrap (string (stateYipBytes ), filepath .Join (oemMount , stateConfigPath ), "Registration State Config" )
266266 afterHookConfigurator .Stages [stage ] = append (afterHookConfigurator .Stages [stage ], stateYip )
267267
268268 // Cloud Init
269269 cloudInitYipBytes , err := i .cloudInitYip (config .CloudConfig )
270270 if err != nil {
271271 return fmt .Errorf ("getting cloud-init config yip: %w" , err )
272272 }
273- cloudInitYip := yipAfterHookWrap (string (cloudInitYipBytes ), filepath .Join (oemMount , cloudInitConfigPath ), "Cloud Init Config" )
273+ cloudInitYip := yipHookWrap (string (cloudInitYipBytes ), filepath .Join (oemMount , cloudInitConfigPath ), "Cloud Init Config" )
274274 afterHookConfigurator .Stages [stage ] = append (afterHookConfigurator .Stages [stage ], cloudInitYip )
275275
276276 // Elemental System Agent
277277 systemAgentYipBytes , err := i .elementalSystemAgentYip (config .Elemental )
278278 if err != nil {
279279 return fmt .Errorf ("getting elemental system agent config yip: %w" , err )
280280 }
281- systemAgentYip := yipAfterHookWrap (string (systemAgentYipBytes ), filepath .Join (oemMount , systemAgentConfigPath ), "Elemental System Agent Config" )
281+ systemAgentYip := yipHookWrap (string (systemAgentYipBytes ), filepath .Join (oemMount , systemAgentConfigPath ), "Elemental System Agent Config" )
282282 afterHookConfigurator .Stages [stage ] = append (afterHookConfigurator .Stages [stage ], systemAgentYip )
283283
284284 // Network Config
@@ -287,7 +287,7 @@ func (i *installer) writeAfterHookConfigurator(stage string, oemMount string, co
287287 return fmt .Errorf ("getting network config yip: %w" , err )
288288 }
289289 if ! errors .Is (err , network .ErrEmptyConfig ) {
290- networkConfigYip := yipAfterHookWrap (string (networkConfigYipBytes ), filepath .Join (oemMount , networkConfigPath ), "Network Config" )
290+ networkConfigYip := yipHookWrap (string (networkConfigYipBytes ), filepath .Join (oemMount , networkConfigPath ), "Network Config" )
291291 afterHookConfigurator .Stages [stage ] = append (afterHookConfigurator .Stages [stage ], networkConfigYip )
292292 }
293293
@@ -296,9 +296,9 @@ func (i *installer) writeAfterHookConfigurator(stage string, oemMount string, co
296296 return fmt .Errorf ("creating directory '%s': %w" , elementalcli .TempCloudInitDir , err )
297297 }
298298 // Create the after hook configurator yip
299- f , err := i .fs .Create (filepath .Join (elementalcli .TempCloudInitDir , elementalAfterHook ))
299+ f , err := i .fs .Create (filepath .Join (elementalcli .TempCloudInitDir , elementalBeforeHook ))
300300 if err != nil {
301- return fmt .Errorf ("creating file '%s': %w" , filepath .Join (elementalcli .TempCloudInitDir , elementalAfterHook ), err )
301+ return fmt .Errorf ("creating file '%s': %w" , filepath .Join (elementalcli .TempCloudInitDir , elementalBeforeHook ), err )
302302 }
303303 defer f .Close ()
304304
@@ -309,7 +309,7 @@ func (i *installer) writeAfterHookConfigurator(stage string, oemMount string, co
309309 return nil
310310}
311311
312- func yipAfterHookWrap (content string , path string , name string ) schema.Stage {
312+ func yipHookWrap (content string , path string , name string ) schema.Stage {
313313 config := schema.Stage {Name : name }
314314 config .Files = []schema.File {
315315 {
0 commit comments