Sha256: 592ca5d316efffad364b0f6049cf17bdce558739c260610acb7c8475ebc3cd93

Contents?: true

Size: 1.63 KB

Versions: 12

Compression:

Stored size: 1.63 KB

Contents

require_relative "../container/provisioner"

require_relative "installer"
require_relative "client"

module VagrantPlugins
  module PodmanProvisioner
    class PodmanError < Vagrant::Errors::VagrantError
      error_namespace("vagrant.provisioners.podman")
    end

    class Provisioner < VagrantPlugins::ContainerProvisioner::Provisioner
      def initialize(machine, config, installer = nil, client = nil)
        super(machine, config, installer, client)

        @installer = installer || Installer.new(@machine)
        @client    = client    || Client.new(@machine)
        @logger = Log4r::Logger.new("vagrant::provisioners::podman")
      end

      def provision
        @logger.info("Checking for Podman installation...")

        if @installer.ensure_installed(config.kubic)
          if !config.post_install_provisioner.nil?
            @logger.info("Running post setup provision script...")
            env = {
                  callable: method(:run_provisioner),
                  provisioner: config.post_install_provisioner,
                  machine: machine}
            machine.env.hook(:run_provisioner, env)
          end
        end

        if config.images.any?
          @machine.ui.info(I18n.t("vagrant.docker_pulling_images"))
          @client.pull_images(*config.images)
        end

        if config.build_images.any?
          @machine.ui.info(I18n.t("vagrant.docker_building_images"))
          @client.build_images(config.build_images)
        end

        if config.containers.any?
          @machine.ui.info(I18n.t("vagrant.docker_starting_containers"))
          @client.run(config.containers)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/provisioners/podman/provisioner.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.3.3.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.3.2.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.19.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.18.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.16.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.14.0 plugins/provisioners/podman/provisioner.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.10.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.9.0 plugins/provisioners/podman/provisioner.rb
vagrant-unbundled-2.2.8.0 plugins/provisioners/podman/provisioner.rb