def machine(name, provider, boxes, data_path, env)
      # Load the configuration for the machine
      results = machine_config(name, provider, boxes, data_path)
      box             = results[:box]
      config          = results[:config]
      config_errors   = results[:config_errors]
      config_warnings = results[:config_warnings]
      provider_cls    = results[:provider_cls]
      provider_options = results[:provider_options]

      # If there were warnings or errors we want to output them
      if !config_warnings.empty? || !config_errors.empty?
        # The color of the output depends on whether we have warnings
        # or errors...
        level  = config_errors.empty? ? :warn : :error
        output = Util::TemplateRenderer.render(
          "config/messages",
          warnings: config_warnings,
          errors: config_errors).chomp
        env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages",
                               name: name,
                               output: output))

        # If we had errors, then we bail
        raise Errors::ConfigUpgradeErrors if !config_errors.empty?
      end

      # Get the provider configuration from the final loaded configuration
      provider_config = config.vm.get_provider_config(provider)

      # Create machine data directory if it doesn't exist
      # XXX: Permissions error here.
      FileUtils.mkdir_p(data_path)

      # Create the machine and cache it for future calls. This will also
      # return the machine from this method.
      return Machine.new(name, provider, provider_cls, provider_config,
        provider_options, config, data_path, box, env, self)
    end
def machine(name, provider, boxes, data_path, env)
      # Load the configuration for the machine
      results = machine_config(name, provider, boxes, data_path)
      box             = results[:box]
      config          = results[:config]
      config_errors   = results[:config_errors]
      config_warnings = results[:config_warnings]
      provider_cls    = results[:provider_cls]
      provider_options = results[:provider_options]

      # If there were warnings or errors we want to output them
      if !config_warnings.empty? || !config_errors.empty?
        # The color of the output depends on whether we have warnings
        # or errors...
        level  = config_errors.empty? ? :warn : :error
        output = Util::TemplateRenderer.render(
          "config/messages",
          warnings: config_warnings,
          errors: config_errors).chomp
        env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages",
                               name: name,
                               output: output))

        # If we had errors, then we bail
        raise Errors::ConfigUpgradeErrors if !config_errors.empty?
      end

      # Get the provider configuration from the final loaded configuration
      provider_config = config.vm.get_provider_config(provider)

      # Create machine data directory if it doesn't exist
      # XXX: Permissions error here.
      FileUtils.mkdir_p(data_path)

      # Create the machine and cache it for future calls. This will also
      # return the machine from this method.
      return Machine.new(name, provider, provider_cls, provider_config,
        provider_options, config, data_path, box, env, self)
    end
Initializes by loading a Vagrantfile.

 @param [Config::Loader] loader Configuration loader that should
   already be configured with the proper Vagrantfile locations.
   This usually comes from {Vagrant::Environment}
 @param [Array<Symbol>] keys The Vagrantfiles to load and the
   order to load them in (keys within the loader).
 Returns a {Machine} for the given name and provider that
 is represented by this Vagrantfile.

 @param [Symbol] name Name of the machine.
 @param [Symbol] provider The provider the machine should
   be backed by (required for provider overrides).
 @param [BoxCollection] boxes BoxCollection to look up the
   box Vagrantfile.
 @param [Pathname] data_path Path where local machine data
   can be stored.
 @param [Environment] env The environment running this machine
 @return [Machine]