diff --git a/acceptance/tests/environment/can_enumerate_environments.rb b/acceptance/tests/environment/can_enumerate_environments.rb index 088e9de1b..46d3d2222 100644 --- a/acceptance/tests/environment/can_enumerate_environments.rb +++ b/acceptance/tests/environment/can_enumerate_environments.rb @@ -1,69 +1,69 @@ test_name "Can enumerate environments via an HTTP endpoint" def master_port(agent) setting_on(agent, "agent", "masterport") end def setting_on(host, section, name) on(host, puppet("config", "print", name, "--section", section)).stdout.chomp end def full_path(host, path) if host['platform'] =~ /win/ on(host, "cygpath '#{path}'").stdout.chomp else path end end def curl_master_from(agent, path, headers = '', &block) url = "https://#{master}:#{master_port(agent)}#{path}" cert_path = full_path(agent, setting_on(agent, "agent", "hostcert")) key_path = full_path(agent, setting_on(agent, "agent", "hostprivkey")) curl_base = "curl --tlsv1 -sg --cert \"#{cert_path}\" --key \"#{key_path}\" -k -H '#{headers}'" on agent, "#{curl_base} '#{url}'", &block end master_user = on(master, "puppet master --configprint user").stdout.strip environments_dir = create_tmpdir_for_user master, "environments" apply_manifest_on(master, <<-MANIFEST) File { ensure => directory, owner => #{master_user}, group => #{master['group']}, - mode => 0770, + mode => "0770", } file { "#{environments_dir}":; "#{environments_dir}/env1":; "#{environments_dir}/env2":; } MANIFEST master_opts = { :master => { :environmentpath => environments_dir } } if master.is_pe? master_opts[:master][:basemodulepath] = master['sitemoduledir'] end with_puppet_running_on(master, master_opts) do agents.each do |agent| step "Ensure that an unauthenticated client cannot access the environments list" do on agent, "curl --tlsv1 -ksv https://#{master}:#{master_port(agent)}/v2.0/environments", :acceptable_exit_codes => [0,7] do assert_match(/< HTTP\/1\.\d 403/, stderr) end end step "Ensure that an authenticated client can retrieve the list of environments" do curl_master_from(agent, '/v2.0/environments') do data = JSON.parse(stdout) assert_equal(["env1", "env2", "production"], data["environments"].keys.sort) end end end end diff --git a/acceptance/tests/environment/cmdline_overrides_environment.rb b/acceptance/tests/environment/cmdline_overrides_environment.rb index 94293a76b..ad3652c7f 100644 --- a/acceptance/tests/environment/cmdline_overrides_environment.rb +++ b/acceptance/tests/environment/cmdline_overrides_environment.rb @@ -1,330 +1,330 @@ test_name "Commandline modulepath and manifest settings override environment" skip_test "CLI-master tests are not applicable" if @options[:is_puppetserver] require 'puppet/acceptance/classifier_utils' extend Puppet::Acceptance::ClassifierUtils classify_nodes_as_agent_specified_if_classifer_present testdir = create_tmpdir_for_user master, 'cmdline_and_environment' environmentpath = "#{testdir}/environments" modulepath = "#{testdir}/modules" manifests = "#{testdir}/manifests" sitepp = "#{manifests}/site.pp" other_manifestdir = "#{testdir}/other_manifests" other_sitepp = "#{other_manifestdir}/site.pp" other_modulepath = "#{testdir}/some_other_modulepath" cmdline_manifest = "#{testdir}/cmdline.pp" step "Prepare manifests and modules" apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) File { ensure => directory, owner => #{master['user']}, group => #{master['group']}, - mode => 0750, + mode => "0750", } ############################################## # A production directory environment file { "#{testdir}":; "#{environmentpath}":; "#{environmentpath}/production":; "#{environmentpath}/production/manifests":; "#{environmentpath}/production/modules":; "#{environmentpath}/production/modules/amod":; "#{environmentpath}/production/modules/amod/manifests":; } file { "#{environmentpath}/production/modules/amod/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => 'class amod { notify { "amod from production environment": } }' } file { "#{environmentpath}/production/manifests/production.pp": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "in production.pp": } include amod ' } ############################################################## # To be set as default manifests and modulepath in puppet.conf file { "#{modulepath}":; "#{modulepath}/amod/":; "#{modulepath}/amod/manifests":; } file { "#{modulepath}/amod/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => 'class amod { notify { "amod from modulepath": } }' } file { "#{manifests}": } file { "#{sitepp}": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "in site.pp": } include amod ' } file { "#{other_manifestdir}": } file { "#{other_sitepp}": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "in other manifestdir site.pp": } include amod ' } ################################ # To be specified on commandline file { "#{other_modulepath}":; "#{other_modulepath}/amod/":; "#{other_modulepath}/amod/manifests":; } file { "#{other_modulepath}/amod/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => 'class amod { notify { "amod from commandline modulepath": } }' } file { "#{cmdline_manifest}": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "in cmdline.pp": } include amod ' } MANIFEST def shutdown_puppet_if_running_as_a_service if master.use_service_scripts? # Beaker defaults to leaving puppet running when using service scripts, # Need to shut it down so we can start up with commandline options on(master, puppet('resource', 'service', master['puppetservice'], 'ensure=stopped')) end end teardown do if master.use_service_scripts? # Beaker defaults to leaving puppet running when using service scripts, on(master, puppet('resource', 'service', master['puppetservice'], 'ensure=running')) end end # Note: this is the semantics seen with legacy environments if commandline # manifest/modulepath are set. step "CASE 1: puppet master with --manifest and --modulepath overrides set production directory environment" do if master.is_using_passenger? step "Skipping for Passenger (PE) setup; since the equivalent of a commandline override would be adding the setting to config.ru, which seems like a very odd thing to do." else shutdown_puppet_if_running_as_a_service master_opts = { 'master' => { 'environmentpath' => environmentpath, 'manifest' => sitepp, 'modulepath' => modulepath, }, :__service_args__ => { :bypass_service_script => true, }, } master_opts_with_cmdline = master_opts.merge(:__commandline_args__ => "--manifest=#{cmdline_manifest} --modulepath=#{other_modulepath}") with_puppet_running_on master, master_opts_with_cmdline, testdir do agents.each do |agent| on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2] ) do assert_match(/in cmdline\.pp/, stdout) assert_match(/amod from commandline modulepath/, stdout) assert_no_match(/production/, stdout) end step "CASE 1a: even if environment is specified" on(agent, puppet("agent -t --server #{master} --environment production"), :acceptable_exit_codes => [2]) do assert_match(/in cmdline\.pp/, stdout) assert_match(/amod from commandline modulepath/, stdout) assert_no_match(/production/, stdout) end end end step "CASE 2: or if you set --manifestdir" do master_opts_with_cmdline = master_opts.merge(:__commandline_args__ => "--manifestdir=#{other_manifestdir} --modulepath=#{other_modulepath}") step "CASE 2: it is ignored if manifest is set in puppet.conf to something not using $manifestdir" with_puppet_running_on master, master_opts_with_cmdline, testdir do agents.each do |agent| on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2]) do assert_match(/in production\.pp/, stdout) assert_match(/amod from commandline modulepath/, stdout) end end end step "CASE 2a: but does pull in the default manifest via manifestdir if manifest is not set" master_opts_with_cmdline = master_opts.merge(:__commandline_args__ => "--manifestdir=#{other_manifestdir} --modulepath=#{other_modulepath}") master_opts_with_cmdline['master'].delete('manifest') with_puppet_running_on master, master_opts_with_cmdline, testdir do agents.each do |agent| on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2]) do assert_match(/in other manifestdir site\.pp/, stdout) assert_match(/amod from commandline modulepath/, stdout) assert_no_match(/production/, stdout) end end end end end end step "CASE 3: puppet master with manifest and modulepath set in puppet.conf is overriden by an existing and set production directory environment" do master_opts = { 'master' => { 'environmentpath' => environmentpath, 'manifest' => sitepp, 'modulepath' => modulepath, } } if master.is_pe? master_opts['master']['basemodulepath'] = master['sitemoduledir'] end with_puppet_running_on master, master_opts, testdir do agents.each do |agent| step "CASE 3: this case is unfortunate, but will be irrelevant when we remove legacyenv in 4.0" on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2] ) do assert_match(/in production\.pp/, stdout) assert_match(/amod from production environment/, stdout) end step "CASE 3a: if environment is specified" on(agent, puppet("agent -t --server #{master} --environment production"), :acceptable_exit_codes => [2]) do assert_match(/in production\.pp/, stdout) assert_match(/amod from production environment/, stdout) end end end end step "CASE 4: puppet master with default manifest, modulepath, environment, environmentpath and an existing '#{environmentpath}/production' directory environment that has not been set" do if master.is_using_passenger? step "Skipping for PE because PE requires most of the existing puppet.conf and /etc/puppetlabs/puppet configuration, and we cannot simply point to a new conf directory." else shutdown_puppet_if_running_as_a_service ssldir = on(master, puppet("master --configprint ssldir")).stdout.chomp master_opts = { :__service_args__ => { :bypass_service_script => true, }, :__commandline_args__ => "--confdir=#{testdir} --ssldir=#{ssldir}" } with_puppet_running_on master, master_opts, testdir do agents.each do |agent| step "CASE 4: #{environmentpath}/production directory environment does not take precedence because default environmentpath is ''" on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2] ) do assert_match(/in site\.pp/, stdout) assert_match(/amod from modulepath/, stdout) end on(agent, puppet("agent -t --server #{master} --environment production"), :acceptable_exit_codes => [2]) do assert_match(/in site\.pp/, stdout) assert_match(/amod from modulepath/, stdout) end end end end end step "CASE 5: puppet master with explicit dynamic environment settings and empty environmentpath" do step "CASE 5: Prepare an additional modulepath module" apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) File { ensure => directory, owner => #{master['user']}, group => #{master['group']}, - mode => 0750, + mode => "0750", } # A second module in another modules dir file { "#{other_modulepath}":; "#{other_modulepath}/bmod/":; "#{other_modulepath}/bmod/manifests":; } file { "#{other_modulepath}/bmod/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => 'class bmod { notify { "bmod from other modulepath": } }' } file { "#{environmentpath}/production/manifests/production.pp": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "in production.pp": } include amod include bmod ' } MANIFEST master_opts = { 'main' => { 'environmentpath' => '', }, 'master' => { 'manifest' => "#{environmentpath}/$environment/manifests", 'modulepath' => "#{environmentpath}/$environment/modules:#{other_modulepath}", } } if master.is_pe? master_opts['master']['modulepath'] << ":#{master['sitemoduledir']}" end with_puppet_running_on master, master_opts, testdir do agents.each do |agent| step "CASE 5: pulls in the production environment based on $environment default" on(agent, puppet("agent -t --server #{master}"), :acceptable_exit_codes => [2] ) do assert_match(/in production\.pp/, stdout) assert_match(/amod from production environment/, stdout) step "CASE 5: and sees modules located in later elements of the modulepath (which would not be seen by a directory env (PUP-2158)" assert_match(/bmod from other modulepath/, stdout) end step "CASE 5a: pulls in the production environment when explicitly set" on(agent, puppet("agent -t --server #{master} --environment production"), :acceptable_exit_codes => [2] ) do assert_match(/in production\.pp/, stdout) assert_match(/amod from production environment/, stdout) step "CASE 5a: and sees modules located in later elements of the modulepath (which would not be seen by a directory env (PUP-2158)" assert_match(/bmod from other modulepath/, stdout) end end end end diff --git a/acceptance/tests/environment/dynamic_environments.rb b/acceptance/tests/environment/dynamic_environments.rb index 7189b001f..7d9e43697 100644 --- a/acceptance/tests/environment/dynamic_environments.rb +++ b/acceptance/tests/environment/dynamic_environments.rb @@ -1,143 +1,143 @@ test_name "Dynamic Environments" require 'puppet/acceptance/classifier_utils' extend Puppet::Acceptance::ClassifierUtils classify_nodes_as_agent_specified_if_classifer_present testdir = create_tmpdir_for_user master, 'dynamic-environment' environmentsdir = "#{testdir}/environments" step "Prepare manifests and modules" def an_environment(envdir, env) content = <<-ENVIRONMENT #################### # #{env} environment file { "#{envdir}/#{env}":; "#{envdir}/#{env}/hiera":; "#{envdir}/#{env}/manifests":; "#{envdir}/#{env}/modules":; "#{envdir}/#{env}/modules/amod":; "#{envdir}/#{env}/modules/amod/manifests":; } file { "#{envdir}/#{env}/hiera/#{env}.yaml": ensure => file, - mode => 0640, + mode => "0640", content => 'foo: foo-#{env}', } file { "#{envdir}/#{env}/hiera/common.yaml": ensure => file, - mode => 0640, + mode => "0640", content => 'foo: foo-common', } file { "#{envdir}/#{env}/manifests/site.pp": ensure => file, - mode => 0640, + mode => "0640", content => ' notify { "#{env}-site.pp": } notify { "hiera": message => hiera(foo), } include amod ' } file { "#{envdir}/#{env}/modules/amod/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => ' class amod { notify { "#{env}-amod": } } ' } ENVIRONMENT end manifest = <<-MANIFEST File { ensure => directory, owner => #{master['user']}, group => #{master['group']}, - mode => 0750, + mode => "0750", } file { "#{testdir}":; "#{environmentsdir}":; } file { "#{testdir}/hiera.yaml": ensure => file, - mode => 0640, + mode => "0640", content => ' --- :backends: yaml :yaml: :datadir: "#{environmentsdir}/%{environment}/hiera" :hierarchy: - "%{environment}" - common ', } #{an_environment(environmentsdir, 'production')} #{an_environment(environmentsdir, 'testing')} MANIFEST apply_manifest_on(master, manifest, :catch_failures => true) def test_on_agents(environment, default_env = false) agents.each do |agent| environment_switch = "--environment #{environment}" if !default_env on(agent, puppet("agent -t --server #{master}", environment_switch), :acceptable_exit_codes => [2] ) do assert_match(/#{environment}-site.pp/, stdout) assert_match(/foo-#{environment}/, stdout) assert_match(/#{environment}-amod/, stdout) end end end ssldir = on(master, puppet("master --configprint ssldir")).stdout.chomp common_opts = { 'environmentpath' => '', 'modulepath' => "#{testdir}/environments/$environment/modules", 'hiera_config' => "#{testdir}/hiera.yaml", } if master.is_pe? common_opts['modulepath'] << ":#{master['sitemoduledir']}" end master_opts = { 'main' => { 'manifest' => "#{testdir}/environments/$environment/manifests/site.pp", }.merge(common_opts) } with_puppet_running_on master, master_opts, testdir do step "Agent run with default environment" test_on_agents('production', true) end master_opts = { 'main' => { 'manifest' => "#{testdir}/environments/$environment/manifests/site.pp", }.merge(common_opts) } with_puppet_running_on master, master_opts, testdir do step "Agent run with testing environment" test_on_agents('testing') step "And then agent run with another environment but the same master process" test_on_agents('production') end master_opts = { 'main' => { 'manifestdir' => "#{testdir}/environments/$environment/manifests", }.merge(common_opts) } with_puppet_running_on master, master_opts, testdir do step "Agent run with testing environment and manifestdir set instead of manifest" test_on_agents('testing') end diff --git a/acceptance/tests/environment/use_environment_from_environmentpath.rb b/acceptance/tests/environment/use_environment_from_environmentpath.rb index ac96ef3a4..8739d76c1 100644 --- a/acceptance/tests/environment/use_environment_from_environmentpath.rb +++ b/acceptance/tests/environment/use_environment_from_environmentpath.rb @@ -1,189 +1,189 @@ test_name "Use environments from the environmentpath" require 'puppet/acceptance/classifier_utils' extend Puppet::Acceptance::ClassifierUtils classify_nodes_as_agent_specified_if_classifer_present testdir = create_tmpdir_for_user master, 'use_environmentpath' def generate_environment(path_to_env, environment) env_content = <<-EOS "#{path_to_env}/#{environment}":; "#{path_to_env}/#{environment}/manifests":; "#{path_to_env}/#{environment}/modules":; EOS end def generate_module_content(module_name, options = {}) base_path = options[:base_path] environment = options[:environment] env_path = options[:env_path] path_to_module = [base_path, env_path, environment, "modules"].compact.join("/") module_info = "module-#{module_name}" module_info << "-from-#{environment}" if environment module_content = <<-EOS "#{path_to_module}/#{module_name}":; "#{path_to_module}/#{module_name}/manifests":; "#{path_to_module}/#{module_name}/files":; "#{path_to_module}/#{module_name}/templates":; "#{path_to_module}/#{module_name}/lib":; "#{path_to_module}/#{module_name}/lib/facter":; "#{path_to_module}/#{module_name}/manifests/init.pp": ensure => file, - mode => 0640, + mode => "0640", content => 'class #{module_name} { notify { "template-#{module_name}": message => template("#{module_name}/our_template.erb") } file { "$agent_file_location/file-#{module_info}": source => "puppet:///modules/#{module_name}/data" } }' ; "#{path_to_module}/#{module_name}/lib/facter/environment_fact_#{module_name}.rb": ensure => file, - mode => 0640, + mode => "0640", content => "Facter.add(:environment_fact_#{module_name}) { setcode { 'environment fact from #{module_info}' } }" ; "#{path_to_module}/#{module_name}/files/data": ensure => file, - mode => 0640, + mode => "0640", content => "data file from #{module_info}" ; "#{path_to_module}/#{module_name}/templates/our_template.erb": ensure => file, - mode => 0640, + mode => "0640", content => "<%= @environment_fact_#{module_name} %>" ; EOS end def generate_site_manifest(path_to_manifest, *modules_to_include) manifest_content = <<-EOS "#{path_to_manifest}/site.pp": ensure => file, - mode => 0640, + mode => "0640", content => "#{modules_to_include.map { |m| "include #{m}" }.join("\n")}" ; EOS end master_user = on(master, "puppet master --configprint user").stdout.strip apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) File { ensure => directory, owner => #{master_user}, group => #{master['group']}, - mode => 0770, + mode => "0770", } file { "#{testdir}":; "#{testdir}/base":; "#{testdir}/additional":; "#{testdir}/modules":; #{generate_environment("#{testdir}/base", "shadowed")} #{generate_environment("#{testdir}/base", "onlybase")} #{generate_environment("#{testdir}/additional", "shadowed")} #{generate_module_content("atmp", :base_path => testdir, :env_path => 'base', :environment => 'shadowed')} #{generate_site_manifest("#{testdir}/base/shadowed/manifests", "atmp", "globalmod")} #{generate_module_content("atmp", :base_path => testdir, :env_path => 'base', :environment => 'onlybase')} #{generate_site_manifest("#{testdir}/base/onlybase/manifests", "atmp", "globalmod")} #{generate_module_content("atmp", :base_path => testdir, :env_path => 'additional', :environment => 'shadowed')} #{generate_site_manifest("#{testdir}/additional/shadowed/manifests", "atmp", "globalmod")} # And one global module (--modulepath setting) #{generate_module_content("globalmod", :base_path => testdir)} "#{testdir}/additional/production":; "#{testdir}/additional/production/manifests":; #{generate_site_manifest("#{testdir}/additional/production/manifests", "globalmod")} } MANIFEST def run_with_environment(agent, environment, options = {}) expected_exit_code = options[:expected_exit_code] || 2 expected_strings = options[:expected_strings] step "running an agent in environment '#{environment}'" atmp = agent.tmpdir("use_environmentpath_#{environment}") agent_config = [ "-t", "--server", master, ] agent_config << '--environment' << environment if environment # This to test how the agent behaves when using the directory environment # loaders (which will not load an environment if it does not exist) agent_config << "--environmentpath='$confdir/environments'" if agent != master agent_config << { 'ENV' => { "FACTER_agent_file_location" => atmp }, } on(agent, puppet("agent", *agent_config), :acceptable_exit_codes => [expected_exit_code]) do |result| yield atmp, result end on agent, "rm -rf #{atmp}" end master_opts = { 'master' => { 'environmentpath' => "#{testdir}/additional:#{testdir}/base", 'basemodulepath' => "#{testdir}/modules", } } if master.is_pe? master_opts['master']['basemodulepath'] << ":#{master['sitemoduledir']}" end with_puppet_running_on master, master_opts, testdir do agents.each do |agent| run_with_environment(agent, "shadowed") do |tmpdir,catalog_result| ["module-atmp-from-shadowed", "module-globalmod"].each do |expected| assert_match(/environment fact from #{expected}/, catalog_result.stdout) end ["module-atmp-from-shadowed", "module-globalmod"].each do |expected| on agent, "cat #{tmpdir}/file-#{expected}" do |file_result| assert_match(/data file from #{expected}/, file_result.stdout) end end end run_with_environment(agent, "onlybase") do |tmpdir,catalog_result| ["module-atmp-from-onlybase", "module-globalmod"].each do |expected| assert_match(/environment fact from #{expected}/, catalog_result.stdout) end ["module-atmp-from-onlybase", "module-globalmod"].each do |expected| on agent, "cat #{tmpdir}/file-#{expected}" do |file_result| assert_match(/data file from #{expected}/, file_result.stdout) end end end run_with_environment(agent, nil, :expected_exit_code => 2) do |tmpdir, catalog_result| assert_no_match(/module-atmp/, catalog_result.stdout, "module-atmp was included despite no environment being loaded") assert_match(/environment fact from module-globalmod/, catalog_result.stdout) on agent, "cat #{tmpdir}/file-module-globalmod" do |file_result| assert_match(/data file from module-globalmod/, file_result.stdout) end end end end diff --git a/acceptance/tests/resource/zone/ticket_4840_should_create_zone_with_zpool.rb b/acceptance/tests/resource/zone/ticket_4840_should_create_zone_with_zpool.rb index 77bfc5ab8..51e72dbdc 100644 --- a/acceptance/tests/resource/zone/ticket_4840_should_create_zone_with_zpool.rb +++ b/acceptance/tests/resource/zone/ticket_4840_should_create_zone_with_zpool.rb @@ -1,37 +1,37 @@ test_name "Zone: ticket #4840 - verify that the given manifest works." confine :to, :platform => 'solaris:pending' require 'puppet/acceptance/solaris_util' extend Puppet::Acceptance::ZoneUtils teardown do agents.each do |agent| clean agent end end agents.each do |agent| setup agent #----------------------------------- # Make sure that the zone is absent. apply_manifest_on(agent,%[ zfs { "tstpool/tstfs": mountpoint => "/ztstpool/mnt", ensure => present, } file { "/ztstpool/mnt": ensure => directory, - mode => 0700, + mode => "0700", require => Zfs["tstpool/tstfs"], } zone { tstzone: autoboot => true, path => "/ztstpool/mnt", sysidcfg => "/tmp/myzone.cfg", iptype => exclusive, ip => "ip.if.1", require => File["/ztstpool/mnt"], }]) do assert_match( /ensure: created/, result.stdout, "err: #{agent}") end end diff --git a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb index 80ce01aba..c8402e3a5 100644 --- a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb +++ b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb @@ -1,46 +1,46 @@ test_name "providers should be useable in the same run they become suitable" agents.each do |agent| dir = agent.tmpdir('provider-6907') on agent, "mkdir -p #{dir}/lib/puppet/{type,provider/test6907}" on agent, "cat > #{dir}/lib/puppet/type/test6907.rb", :stdin => < true) newproperty(:file) end TYPE on agent, "cat > #{dir}/lib/puppet/provider/test6907/only.rb", :stdin => < "#{dir}/must_exist.exe" require 'fileutils' def file 'not correct' end def file=(value) FileUtils.touch(value) end end PROVIDER on agent, puppet_apply("--libdir #{dir}/lib --trace"), :stdin => < "#{dir}/test_file", } # The name of the file is chosen to be *.exe so it works on windows and *nix # becasue windows inspects the PATHEXT environment variable in 1.9.3 and later. file { "#{dir}/must_exist.exe": ensure => file, - mode => 0755, + mode => "0755", } MANIFEST on agent, "ls #{dir}/test_file" end