@@ -55,34 +55,39 @@ var loadImageCmd = &cobra.Command{
55
55
if err != nil {
56
56
exit .Error (reason .Usage , "loading profile" , err )
57
57
}
58
- img := args [0 ]
59
58
60
59
var local bool
61
60
if imgRemote || imgDaemon {
62
61
local = false
63
- } else if strings .HasPrefix (img , "/" ) || strings .HasPrefix (img , "." ) {
64
- local = true
65
- imgDaemon = false
66
- imgRemote = false
67
- } else if _ , err := os .Stat (img ); err == nil {
68
- local = true
69
- imgDaemon = false
70
- imgRemote = false
71
62
} else {
72
- imgDaemon = true
73
- imgRemote = true
63
+ for _ , img := range args {
64
+ if strings .HasPrefix (img , "/" ) || strings .HasPrefix (img , "." ) {
65
+ local = true
66
+ imgDaemon = false
67
+ imgRemote = false
68
+ } else if _ , err := os .Stat (img ); err == nil {
69
+ local = true
70
+ imgDaemon = false
71
+ imgRemote = false
72
+ }
73
+ }
74
+
75
+ if ! local {
76
+ imgDaemon = true
77
+ imgRemote = true
78
+ }
74
79
}
75
80
76
81
// Currently "image.retrieveImage" always tries to load both from daemon and from remote
77
82
// There is no way to skip daemon.Image or remote.Image, for the vague "ref" string given.
78
83
if imgDaemon || imgRemote {
79
- if err := machine .CacheAndLoadImages ([] string { img } , []* config.Profile {profile }); err != nil {
84
+ if err := machine .CacheAndLoadImages (args , []* config.Profile {profile }); err != nil {
80
85
exit .Error (reason .GuestImageLoad , "Failed to load image" , err )
81
86
}
82
87
// Load images from local files, without doing any caching or checks in container runtime
83
88
// This is similar to tarball.Image but it is done by the container runtime in the cluster.
84
89
} else if local {
85
- if err := machine .DoLoadImages ([] string { img } , []* config.Profile {profile }, "" ); err != nil {
90
+ if err := machine .DoLoadImages (args , []* config.Profile {profile }, "" ); err != nil {
86
91
exit .Error (reason .GuestImageLoad , "Failed to load image" , err )
87
92
}
88
93
}
0 commit comments