File: pull.rb

package info (click to toggle)
vagrant 2.2.14%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,800 kB
  • sloc: ruby: 97,301; sh: 375; makefile: 16; lisp: 1
file content (27 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module VagrantPlugins
  module DockerProvider
    module Action
      class Pull
        def initialize(app, env)
          @app = app
        end

        def call(env)
          @env             = env
          @machine         = env[:machine]
          @provider_config = @machine.provider_config
          @driver          = @machine.provider.driver

          # Skip pulling if the image is built
          return @app.call(env) if @env[:create_image] || !@provider_config.pull

          image = @provider_config.image
          env[:ui].output(I18n.t("docker_provider.pull", image: image))
          @driver.pull(image)

          @app.call(env)
        end
      end
    end
  end
end