1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
test_name "Content Attribute"
step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/content_file_test.txt'
step "Content Attribute: using raw content"
manifest = "file { '/tmp/content_file_test.txt': content => 'This is the test file content', ensure => present }"
apply_manifest_on agents, manifest
agents.each do |host|
on host, "cat /tmp/content_file_test.txt" do
assert_match(/This is the test file content/, stdout, "File content not matched on #{host}")
end
end
step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/content_file_test.txt'
step "Content Attribute: using a checksum from filebucket"
on agents, "echo 'This is the checksum file contents' > /tmp/checksum_test_file.txt"
step "Backup file into the filebucket"
on agents, puppet_filebucket("backup --local /tmp/checksum_test_file.txt")
agents.each do |agent|
bucketdir="not set"
on agent, puppet_filebucket("--configprint bucketdir") do
bucketdir = stdout.chomp
end
manifest = %Q|
filebucket { 'local':
path => '#{bucketdir}',
}
file { '/tmp/content_file_test.txt':
content => '{md5}18571d3a04b2bb7ccfdbb2c44c72caa9',
ensure => present,
backup => local,
}
|
step "Applying Manifest on Agents"
apply_manifest_on agent, manifest
end
step "Validate filebucket checksum file contents"
agents.each do |host|
on host, "cat /tmp/content_file_test.txt" do
assert_match(/This is the checksum file content/, stdout, "File content not matched on #{host}")
end
end
|