@@ -34,18 +34,24 @@ 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+ if strings .EqualFold (image , c .RegistryURL ) {
47+ err = img .NewImage (h .log ).OciPull (ctx , c .RegistryURL , h .osImageDestination , c .Username , c .Password )
48+ } else {
49+ err = img .NewImage (h .log ).OciPull (ctx , image , h .osImageDestination , "" , "" )
50+ }
51+ if err != nil {
52+ return nil , err
53+ }
54+ }
4955 }
5056 } else {
5157 err = img .NewImage (h .log ).Pull (image , h .osImageDestination )
0 commit comments