@@ -34,18 +34,20 @@ func (h *hammer) Install(machine *models.V1MachineResponse) (*api.Bootinfo, erro
3434 h .log .Info ("checking oci image" , "image" , image )
3535 if strings .HasPrefix (image , "oci://" ) {
3636 ociConfigs := h .spec .MetalConfig .OciConfig
37+ ctx := context .Background ()
3738
38- for _ , c := range ociConfigs {
39- ctx := context .Background ()
40-
41- if strings .EqualFold (image , c .RegistryURL ) {
42- err = img .NewImage (h .log ).OciPull (ctx , c .RegistryURL , h .osImageDestination , c .Username , c .Password )
43- } else {
44- err = img .NewImage (h .log ).OciPull (ctx , image , h .osImageDestination , "" , "" )
45- }
39+ if len (ociConfigs ) == 0 {
40+ err = img .NewImage (h .log ).OciPull (ctx , image , h .osImageDestination , "" , "" )
4641 if err != nil {
4742 return nil , err
4843 }
44+ } else {
45+ for _ , c := range ociConfigs {
46+ err = img .NewImage (h .log ).OciPull (ctx , c .RegistryURL , h .osImageDestination , c .Username , c .Password )
47+ if err != nil {
48+ return nil , err
49+ }
50+ }
4951 }
5052 } else {
5153 err = img .NewImage (h .log ).Pull (image , h .osImageDestination )
0 commit comments