<commit_before>require 'log4r'

module Vagrant
  module Puppet
    module Scp
      class PuppetScpError < Vagrant::Errors::VagrantError
        error_namespace('vagrant.provisioners.puppet_scp')
      end

      class Provisioner < Vagrant.plugin(2, :provisioner)
        def initialize(machine, config)
          super

          @logger = Log4r::Logger.new('vagrant::provisioners::puppet_scp')
        end

        def configure(root_config)
          # Calculate the paths we're going to use based on the environment
          root_path = @machine.env.root_path
          @expanded_manifests_path = @config.expanded_manifests_path(root_path)
          @expanded_module_path = @config.expanded_module_path(root_path)
          @manifest_file = File.join(@config.manifests_guest_path, @config.manifest_file)
          @module_path = File.join(@config.pp_path, @config.module_path)
        end

        def provision
          create_pp_path
          share_manifests
          share_modules
          verify_binary('puppet')
          run_puppet_apply
        end

        def create_pp_path
          @machine.communicate.tap do |comm|
            comm.sudo("mkdir -p #{@config.pp_path}")
            comm.sudo("chown -R #{@machine.ssh_info[:username]}")
          end
        end

        def share_manifests
          @machine.communicate.upload(@expanded_manifests_path, @config.manifests_guest_path)
        end

        def share_modules
          @machine.communicate.upload(@expanded_module_path, @config.module_guest_path)
        end

        def verify_binary(binary)
          @machine.communicate.sudo(
            "which #{binary}",
            :error_class => PuppetError,
            :error_key => :not_detected,
            :binary => binary)
        end

        def run_puppet_apply
          options = [config.options].flatten
          options << "--modulepath '#{@module_path}'" if !@module_path.empty?<commit_msg>Chown the pp path.<commit_after>require 'log4r'

module Vagrant
  module Puppet
    module Scp
      class PuppetScpError < Vagrant::Errors::VagrantError
        error_namespace('vagrant.provisioners.puppet_scp')
      end

      class Provisioner < Vagrant.plugin(2, :provisioner)
        def initialize(machine, config)
          super

          @logger = Log4r::Logger.new('vagrant::provisioners::puppet_scp')
        end

        def configure(root_config)
          # Calculate the paths we're going to use based on the environment
          root_path = @machine.env.root_path
          @expanded_manifests_path = @config.expanded_manifests_path(root_path)
          @expanded_module_path = @config.expanded_module_path(root_path)
          @manifest_file = File.join(@config.manifests_guest_path, @config.manifest_file)
          @module_path = File.join(@config.pp_path, @config.module_path)
        end

        def provision
          create_pp_path
          share_manifests
          share_modules
          verify_binary('puppet')
          run_puppet_apply
        end

        def create_pp_path
          @machine.communicate.tap do |comm|
            comm.sudo("mkdir -p #{@config.pp_path}")
            comm.sudo("chown -R #{@machine.ssh_info[:username]} #{@config.pp_path}")
          end
        end

        def share_manifests
          @machine.communicate.upload(@expanded_manifests_path, @config.manifests_guest_path)
        end

        def share_modules
          @machine.communicate.upload(@expanded_module_path, @config.module_guest_path)
        end

        def verify_binary(binary)
          @machine.communicate.sudo(
            "which #{binary}",
            :error_class => PuppetError,
            :error_key => :not_detected,
            :binary => binary)
        end

        def run_puppet_apply
          options = [config.options].flatten
          options << "--modulepath '#{@module_path}'" if !@module_path.empty?
{'fraction_non_alphanumeric': 0.0917948717948718, 'fraction_numerical': 0.0015384615384615385, 'mean_word_length': 2.32, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5756532', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1156, 'n_words': 207}