[Pkg-puppet-devel] Bug#698294: Some simple test cases to consider

Chris Boot crb at tiger-computing.co.uk
Wed Mar 6 12:23:12 UTC 2013


Hi,

Because people seem to think this is some obscure corner case, I thought
I'd write up a very simple test case to trigger the problem:

First, some setup:

crb at chris ~ $ echo testing > testfile
crb at chris ~ $ ln -s testfile testlink

First test, to create a file that doesn't exist:

crb at chris ~ $ puppet resource file $(pwd)/newfile ensure=file
links=follow source=$(pwd)/testlink mode=0644
err: /File[/home/crb/newfile]/ensure: change from absent to present
failed: Could not rename temporary file /home/crb/newfile.puppettmp_6080
to /home/crb/newfile: File written to disk did not match checksum;
discarding changes ( vs {md5}d41d8cd98f00b204e9800998ecf8427e)
file { '/home/crb/newfile':
  ensure => 'absent',
}

As you can see, the file is not created and Puppet produces an error.

Second test, to update the contents of the file if it exists with the
wrong content:

crb at chris ~ $ echo foobar > newfile
crb at chris ~ $ puppet resource file $(pwd)/newfile ensure=file
links=follow source=$(pwd)/testlink mode=0644
file { '/home/crb/newfile':
  ensure => 'file',
  group  => '1000',
  mode   => '644',
}
crb at chris ~ $ cat newfile
foobar

This time, Puppet does not produce an error at all, but the contents of
the file remains unchanged and un-managed. In this case, this is silent
corruption as Puppet fails to enforce the content change on the file.

Best regards,
Chris

-- 
|Chris Boot
|Tiger Computing Ltd
|"Linux for Business"
|
|Tel: 033 0088 1511
|Web: http://www.tiger-computing.co.uk
|
|Registered in England. Company number: 3389961
|Registered address: Wyastone Business Park,
| Wyastone Leys, Monmouth, NP25 3SR



More information about the Pkg-puppet-devel mailing list