~ubuntu-branches/ubuntu/precise/puppet/precise-proposed

« back to all changes in this revision

Viewing changes to acceptance/tests/resource/exec/should_not_run_command_creates.rb

  • Committer: Package Import Robot
  • Author(s): Micah Anderson
  • Date: 2012-02-23 18:24:48 UTC
  • mfrom: (1.1.28) (3.1.36 sid)
  • Revision ID: package-import@ubuntu.com-20120223182448-belun93murza4w99
Tags: 2.7.11-1
* New upstream release
* Urgency set to high due to regressions in previous release
  and security vulnerabilities
* Execs when run with a user specified, but no group, get the root
  group. Similarly unexpected privileges are given to providers and
  types (egid remains as root), this is fixed with a patch from
  upstream (CVE-2012-1053)
* Fix Klogin write through symlink (CVE-2012-1054)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
test_name "should not run command creates"
 
2
 
 
3
touch      = "/tmp/touched-#{Time.new.to_i}"
 
4
donottouch = "/tmp/not-touched-#{Time.new.to_i}"
 
5
 
 
6
manifest = %Q{
 
7
  exec { "test#{Time.new.to_i}": command => '/bin/touch #{donottouch}', creates => "#{touch}"}
 
8
}
 
9
 
 
10
step "prepare the agents for the test"
 
11
on agents, "touch #{touch} ; rm -f #{donottouch}"
 
12
 
 
13
step "test using puppet apply"
 
14
apply_manifest_on(agents, manifest) do
 
15
    fail_test "looks like the thing executed, which it shouldn't" if
 
16
        stdout.include? 'executed successfully'
 
17
end
 
18
 
 
19
step "verify the file didn't get created"
 
20
on agents, "test -f #{donottouch}", :acceptable_exit_codes => [1]
 
21
 
 
22
step "prepare the agents for the second part of the test"
 
23
on agents, "touch #{touch} ; rm -f #{donottouch}"
 
24
 
 
25
step "test using puppet resource"
 
26
on(agents, puppet_resource('exec', "test#{Time.new.to_i}",
 
27
              "command='/bin/touch #{donottouch}'",
 
28
              "creates='#{touch}'")) do
 
29
    fail_test "looks like the thing executed, which it shouldn't" if
 
30
        stdout.include? 'executed successfully'
 
31
end
 
32
 
 
33
step "verify the file didn't get created the second time"
 
34
on agents, "test -f #{donottouch}", :acceptable_exit_codes => [1]