Sha256: 4cabbac7c1acf86961b97801ad4f08dd05643e37b75900ebe0c7994c7ee6c6fb

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

module VagrantPlugins
  module CommandUp
    module StartMixins
      # This adds the standard `start` command line flags to the given
      # OptionParser, storing the result in the `options` dictionary.
      #
      # @param [OptionParser] parser
      # @param [Hash] options
      def build_start_options(parser, options)
        # Setup the defaults
        options[:provision_types] = nil

        # Add the options
        parser.on("--[no-]provision", "Enable or disable provisioning") do |p|
          options[:provision_enabled] = p
        end

        parser.on("--provision-with x,y,z", Array,
                "Enable only certain provisioners, by type.") do |list|
          options[:provision_types] = list.map { |type| type.to_sym }
        end
      end

      # This validates the provisioner flags and raises an exception
      # if there are invalid ones.
      def validate_provisioner_flags!(options)
        (options[:provision_types] || []).each do |type|
            klass = Vagrant.plugin("2").manager.provisioners[type]
            if !klass
              raise Vagrant::Errors::ProvisionerFlagInvalid,
                name: type.to_s
            end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/commands/up/start_mixins.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/commands/up/start_mixins.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/commands/up/start_mixins.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/commands/up/start_mixins.rb
tnargav-1.3.6 plugins/commands/up/start_mixins.rb
tnargav-1.3.3 plugins/commands/up/start_mixins.rb