freighthop 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Puppetfile +1 -1
- data/Puppetfile.lock +4 -5
- data/README.md +18 -7
- data/Vagrantfile +4 -0
- data/lib/freighthop/cli/help.rb +1 -0
- data/lib/freighthop/cli/init.rb +10 -10
- data/lib/freighthop/cli/version.rb +17 -0
- data/lib/freighthop/cli.rb +3 -1
- data/lib/freighthop/version.rb +1 -1
- data/lib/freighthop.rb +4 -0
- data/modules/apt/CHANGELOG +2 -36
- data/modules/apt/Gemfile +5 -6
- data/modules/apt/Gemfile.lock +7 -40
- data/modules/apt/Modulefile +1 -1
- data/modules/apt/README.md +1 -2
- data/modules/apt/Rakefile +0 -1
- data/modules/apt/manifests/init.pp +2 -5
- data/modules/apt/manifests/params.pp +1 -4
- data/modules/apt/manifests/pin.pp +1 -1
- data/modules/apt/manifests/ppa.pp +10 -24
- data/modules/apt/manifests/update.pp +0 -1
- data/modules/apt/metadata.json +19 -32
- data/modules/apt/spec/defines/ppa_spec.rb +2 -53
- data/modules/apt/spec/defines/source_spec.rb +2 -2
- data/modules/apt/templates/source.list.erb +2 -2
- data/modules/apt/tests/key.pp +3 -3
- data/modules/concat/CHANGELOG +73 -0
- data/modules/concat/Gemfile +20 -0
- data/modules/concat/Gemfile.lock +104 -0
- data/modules/concat/Modulefile +7 -6
- data/modules/concat/README.md +440 -0
- data/modules/concat/Rakefile +5 -1
- data/modules/concat/files/concatfragments.rb +137 -0
- data/modules/concat/files/concatfragments.sh +15 -4
- data/modules/concat/lib/facter/concat_basedir.rb +9 -3
- data/modules/concat/manifests/fragment.pp +108 -48
- data/modules/concat/manifests/init.pp +191 -210
- data/modules/concat/manifests/setup.pp +31 -31
- data/modules/concat/metadata.json +40 -21
- data/modules/{apt → concat}/spec/spec_helper_system.rb +11 -6
- data/modules/{firewall → concat}/spec/system/basic_spec.rb +1 -1
- data/modules/concat/spec/system/concat_spec.rb +154 -0
- data/modules/concat/spec/system/deprecation_warnings_spec.rb +247 -0
- data/modules/concat/spec/system/empty_spec.rb +27 -0
- data/modules/concat/spec/system/fragment_source_spec.rb +142 -0
- data/modules/concat/spec/system/replace_spec.rb +257 -0
- data/modules/concat/spec/system/symbolic_name_spec.rb +35 -0
- data/modules/concat/spec/system/warn_spec.rb +106 -0
- data/modules/concat/spec/unit/classes/concat_setup_spec.rb +42 -0
- data/modules/concat/spec/unit/defines/concat_fragment_spec.rb +267 -0
- data/modules/concat/spec/unit/defines/concat_spec.rb +380 -0
- data/modules/concat/spec/unit/facts/concat_basedir_spec.rb +18 -0
- data/modules/concat/tests/fragment.pp +19 -0
- data/modules/concat/tests/init.pp +7 -0
- data/modules/firewall/Changelog +38 -0
- data/modules/firewall/Gemfile +5 -2
- data/modules/firewall/Gemfile.lock +76 -26
- data/modules/firewall/Modulefile +1 -1
- data/modules/firewall/README.markdown +47 -15
- data/modules/firewall/Rakefile +0 -7
- data/modules/firewall/lib/puppet/provider/firewall/ip6tables.rb +50 -7
- data/modules/firewall/lib/puppet/provider/firewall/iptables.rb +147 -31
- data/modules/firewall/lib/puppet/provider/firewallchain/iptables_chain.rb +19 -8
- data/modules/firewall/lib/puppet/type/firewall.rb +207 -3
- data/modules/firewall/lib/puppet/type/firewallchain.rb +73 -2
- data/modules/firewall/lib/puppet/util/firewall.rb +14 -0
- data/modules/firewall/metadata.json +181 -76
- data/modules/firewall/spec/acceptance/basic_spec.rb +8 -0
- data/modules/firewall/spec/acceptance/change_source_spec.rb +77 -0
- data/modules/firewall/spec/acceptance/class_spec.rb +27 -0
- data/modules/firewall/spec/acceptance/firewall_spec.rb +1608 -0
- data/modules/firewall/spec/acceptance/firewallchain_spec.rb +125 -0
- data/modules/firewall/spec/acceptance/ip6_fragment_spec.rb +94 -0
- data/modules/firewall/spec/acceptance/isfragment_spec.rb +92 -0
- data/modules/firewall/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/centos-64-x64-fusion.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
- data/modules/firewall/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/debian-607-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/debian-70rc1-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/default.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/sles-11sp1-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
- data/modules/firewall/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
- data/modules/firewall/spec/{system → acceptance}/params_spec.rb +44 -52
- data/modules/firewall/spec/acceptance/purge_spec.rb +124 -0
- data/modules/firewall/spec/acceptance/resource_cmd_spec.rb +93 -0
- data/modules/firewall/spec/acceptance/rules_spec.rb +248 -0
- data/modules/firewall/spec/acceptance/socket_spec.rb +96 -0
- data/modules/firewall/spec/{system → acceptance}/standard_usage_spec.rb +6 -10
- data/modules/firewall/spec/fixtures/ip6tables/conversion_hash.rb +107 -0
- data/modules/firewall/spec/fixtures/iptables/conversion_hash.rb +56 -2
- data/modules/firewall/spec/spec_helper_acceptance.rb +38 -0
- data/modules/firewall/spec/unit/classes/firewall_spec.rb +2 -2
- data/modules/firewall/spec/unit/facter/iptables_persistent_version_spec.rb +8 -5
- data/modules/firewall/spec/unit/facter/iptables_spec.rb +6 -4
- data/modules/firewall/spec/unit/puppet/provider/iptables_chain_spec.rb +14 -4
- data/modules/firewall/spec/unit/puppet/provider/iptables_spec.rb +246 -5
- data/modules/firewall/spec/unit/puppet/type/firewall_spec.rb +99 -8
- data/modules/firewall/spec/unit/puppet/type/firewallchain_spec.rb +50 -6
- data/modules/firewall/spec/unit/puppet/util/firewall_spec.rb +21 -0
- data/modules/mysql/CHANGELOG +0 -30
- data/modules/mysql/Gemfile +0 -1
- data/modules/mysql/Gemfile.lock +30 -31
- data/modules/mysql/Modulefile +1 -1
- data/modules/mysql/README.md +2 -49
- data/modules/mysql/files/mysqltuner.pl +1 -1
- data/modules/mysql/lib/puppet/provider/database/mysql.rb +1 -1
- data/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +1 -1
- data/modules/mysql/lib/puppet/provider/database_user/mysql.rb +1 -1
- data/modules/mysql/lib/puppet/provider/mysql.rb +1 -2
- data/modules/mysql/lib/puppet/provider/mysql_database/mysql.rb +13 -2
- data/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb +12 -0
- data/modules/mysql/lib/puppet/type/database_user.rb +1 -1
- data/modules/mysql/lib/puppet/type/mysql_grant.rb +3 -5
- data/modules/mysql/manifests/client.pp +0 -7
- data/modules/mysql/manifests/server/root_password.pp +0 -2
- data/modules/mysql/manifests/server.pp +0 -6
- data/modules/mysql/metadata.json +79 -81
- data/modules/mysql/spec/classes/mysql_server_spec.rb +0 -74
- data/modules/mysql/spec/system/mysql_server_root_password_spec.rb +1 -7
- data/modules/mysql/spec/system/mysql_server_spec.rb +3 -6
- data/modules/mysql/spec/system/types/mysql_grant_spec.rb +0 -27
- data/modules/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb +1 -1
- data/modules/mysql/spec/unit/puppet/provider/database/mysql_spec.rb +4 -4
- data/modules/mysql/spec/unit/puppet/provider/database_grant/mysql_spec.rb +15 -15
- data/modules/mysql/spec/unit/puppet/provider/database_user/mysql_spec.rb +4 -4
- data/modules/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb +3 -3
- data/modules/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb +3 -3
- data/modules/mysql/templates/my.cnf.erb +2 -4
- data/modules/mysql/tests/mysql_grant.pp +1 -1
- data/modules/postgresql/Changelog +31 -0
- data/modules/postgresql/Gemfile +4 -2
- data/modules/postgresql/Modulefile +1 -1
- data/modules/postgresql/README.md +10 -4
- data/modules/postgresql/Rakefile +0 -1
- data/modules/postgresql/lib/puppet/provider/postgresql_psql/ruby.rb +25 -3
- data/modules/postgresql/manifests/globals.pp +2 -0
- data/modules/postgresql/manifests/params.pp +21 -0
- data/modules/postgresql/manifests/server/config.pp +0 -5
- data/modules/postgresql/manifests/server/config_entry.pp +1 -1
- data/modules/postgresql/manifests/server/database.pp +2 -1
- data/modules/postgresql/manifests/server/db.pp +2 -0
- data/modules/postgresql/manifests/server/grant.pp +20 -16
- data/modules/postgresql/manifests/server/initdb.pp +27 -3
- data/modules/postgresql/manifests/server/pg_hba_rule.pp +2 -4
- data/modules/postgresql/manifests/server/role.pp +8 -2
- data/modules/postgresql/manifests/server/service.pp +5 -0
- data/modules/postgresql/manifests/server.pp +2 -0
- data/modules/postgresql/metadata.json +88 -65
- data/modules/postgresql/spec/acceptance/client_spec.rb +18 -0
- data/modules/postgresql/spec/{system → acceptance}/common_patterns_spec.rb +8 -14
- data/modules/postgresql/spec/{system → acceptance}/contrib_spec.rb +4 -9
- data/modules/postgresql/spec/acceptance/lib/devel_spec.rb +17 -0
- data/modules/postgresql/spec/acceptance/lib/java_spec.rb +20 -0
- data/modules/postgresql/spec/acceptance/lib/python_spec.rb +19 -0
- data/modules/postgresql/spec/acceptance/nodesets/centos-510-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
- data/modules/postgresql/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/debian-607-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/debian-73-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/default.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
- data/modules/postgresql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
- data/modules/postgresql/spec/{system → acceptance}/postgresql_psql_spec.rb +6 -14
- data/modules/postgresql/spec/{system → acceptance}/server/config_entry_spec.rb +6 -12
- data/modules/postgresql/spec/{system → acceptance}/server/database_grant_spec.rb +6 -12
- data/modules/postgresql/spec/{system → acceptance}/server/database_spec.rb +6 -12
- data/modules/postgresql/spec/{system → acceptance}/server/db_spec.rb +47 -42
- data/modules/postgresql/spec/{system → acceptance}/server/grant_spec.rb +6 -12
- data/modules/postgresql/spec/{system → acceptance}/server/pg_hba_rule_spec.rb +10 -23
- data/modules/postgresql/spec/{system → acceptance}/server/plperl_spec.rb +6 -10
- data/modules/postgresql/spec/{system → acceptance}/server/role_spec.rb +13 -28
- data/modules/postgresql/spec/acceptance/server/table_grant_spec.rb +124 -0
- data/modules/postgresql/spec/{system → acceptance}/server/tablespace_spec.rb +8 -22
- data/modules/postgresql/spec/{system → acceptance}/server_spec.rb +38 -61
- data/modules/postgresql/spec/{system → acceptance}/validate_db_connection_spec.rb +8 -20
- data/modules/postgresql/spec/spec_helper_acceptance.rb +70 -0
- data/modules/postgresql/spec/unit/classes/globals_spec.rb +2 -2
- data/modules/postgresql/spec/unit/classes/lib/devel_spec.rb +1 -1
- data/modules/postgresql/spec/unit/classes/params_spec.rb +1 -1
- data/modules/postgresql/spec/unit/classes/repo_spec.rb +1 -1
- data/modules/postgresql/spec/unit/classes/server/initdb_spec.rb +2 -1
- data/modules/postgresql/spec/unit/classes/server/plperl_spec.rb +2 -2
- data/modules/postgresql/spec/unit/classes/server_spec.rb +9 -2
- data/modules/postgresql/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +15 -17
- data/modules/rbenv/bin/autospec +0 -0
- data/modules/rbenv/bin/facter +0 -0
- data/modules/rbenv/bin/filebucket +0 -0
- data/modules/rbenv/bin/hiera +0 -0
- data/modules/rbenv/bin/htmldiff +0 -0
- data/modules/rbenv/bin/ldiff +0 -0
- data/modules/rbenv/bin/pi +0 -0
- data/modules/rbenv/bin/puppet +0 -0
- data/modules/rbenv/bin/puppet-lint +0 -0
- data/modules/rbenv/bin/puppet-module +0 -0
- data/modules/rbenv/bin/puppetca +0 -0
- data/modules/rbenv/bin/puppetd +0 -0
- data/modules/rbenv/bin/puppetdoc +0 -0
- data/modules/rbenv/bin/puppetmasterd +0 -0
- data/modules/rbenv/bin/puppetqd +0 -0
- data/modules/rbenv/bin/puppetrun +0 -0
- data/modules/rbenv/bin/rake +0 -0
- data/modules/rbenv/bin/ralsh +0 -0
- data/modules/rbenv/bin/rspec +0 -0
- data/modules/rbenv/bin/rspec-puppet-init +0 -0
- data/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb +0 -0
- data/modules/stdlib/spec/monkey_patches/publicize_methods.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb +0 -0
- data/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb +0 -0
- metadata +92 -77
- data/modules/apt/manifests/unattended_upgrades.pp +0 -68
- data/modules/apt/spec/classes/unattended_upgrades_spec.rb +0 -204
- data/modules/apt/spec/system/apt_builddep_spec.rb +0 -38
- data/modules/apt/spec/system/apt_key_spec.rb +0 -53
- data/modules/apt/spec/system/apt_ppa_spec.rb +0 -59
- data/modules/apt/spec/system/apt_source_spec.rb +0 -51
- data/modules/apt/spec/system/basic_spec.rb +0 -10
- data/modules/apt/spec/system/class_spec.rb +0 -20
- data/modules/apt/templates/10periodic.erb +0 -12
- data/modules/apt/templates/50unattended-upgrades.erb +0 -53
- data/modules/apt/tests/unattended-upgrades.pp +0 -1
- data/modules/concat/README.markdown +0 -150
- data/modules/concat/spec/defines/init_spec.rb +0 -115
- data/modules/concat/spec/fixtures/manifests/site.pp +0 -0
- data/modules/firewall/spec/spec_helper_system.rb +0 -49
- data/modules/firewall/spec/system/class_spec.rb +0 -39
- data/modules/firewall/spec/system/purge_spec.rb +0 -29
- data/modules/firewall/spec/system/resource_cmd_spec.rb +0 -53
- data/modules/mysql/manifests/server/providers.pp +0 -8
- data/modules/mysql/tests/bindings.pp +0 -3
- data/modules/postgresql/Gemfile.lock +0 -74
- data/modules/postgresql/spec/spec_helper_system.rb +0 -66
- data/modules/postgresql/spec/system/client_spec.rb +0 -22
- data/modules/postgresql/spec/system/lib/devel_spec.rb +0 -22
- data/modules/postgresql/spec/system/lib/java_spec.rb +0 -25
- data/modules/postgresql/spec/system/lib/python_spec.rb +0 -24
- data/modules/postgresql/spec/system/server/table_grant_spec.rb +0 -72
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'concat::fragment source' do
|
4
|
+
context 'should read file fragments from local system' do
|
5
|
+
before(:all) do
|
6
|
+
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
|
7
|
+
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
|
8
|
+
end
|
9
|
+
|
10
|
+
pp = <<-EOS
|
11
|
+
concat { '/tmp/concat/foo': }
|
12
|
+
|
13
|
+
concat::fragment { '1':
|
14
|
+
target => '/tmp/concat/foo',
|
15
|
+
source => '/tmp/concat/file1',
|
16
|
+
}
|
17
|
+
concat::fragment { '2':
|
18
|
+
target => '/tmp/concat/foo',
|
19
|
+
content => 'string1 contents',
|
20
|
+
}
|
21
|
+
concat::fragment { '3':
|
22
|
+
target => '/tmp/concat/foo',
|
23
|
+
source => '/tmp/concat/file2',
|
24
|
+
}
|
25
|
+
EOS
|
26
|
+
|
27
|
+
context puppet_apply(pp) do
|
28
|
+
its(:stderr) { should be_empty }
|
29
|
+
its(:exit_code) { should_not == 1 }
|
30
|
+
its(:refresh) { should be_nil }
|
31
|
+
its(:stderr) { should be_empty }
|
32
|
+
its(:exit_code) { should be_zero }
|
33
|
+
end
|
34
|
+
|
35
|
+
describe file('/tmp/concat/foo') do
|
36
|
+
it { should be_file }
|
37
|
+
it { should contain 'file1 contents' }
|
38
|
+
it { should contain 'string1 contents' }
|
39
|
+
it { should contain 'file2 contents' }
|
40
|
+
end
|
41
|
+
end # should read file fragments from local system
|
42
|
+
|
43
|
+
context 'should create files containing first match only.' do
|
44
|
+
before(:all) do
|
45
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
46
|
+
shell('mkdir -p /tmp/concat')
|
47
|
+
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
|
48
|
+
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
|
49
|
+
end
|
50
|
+
|
51
|
+
pp = <<-EOS
|
52
|
+
concat { '/tmp/concat/result_file1':
|
53
|
+
owner => root,
|
54
|
+
group => root,
|
55
|
+
mode => '0644',
|
56
|
+
}
|
57
|
+
concat { '/tmp/concat/result_file2':
|
58
|
+
owner => root,
|
59
|
+
group => root,
|
60
|
+
mode => '0644',
|
61
|
+
}
|
62
|
+
concat { '/tmp/concat/result_file3':
|
63
|
+
owner => root,
|
64
|
+
group => root,
|
65
|
+
mode => '0644',
|
66
|
+
}
|
67
|
+
|
68
|
+
concat::fragment { '1':
|
69
|
+
target => '/tmp/concat/result_file1',
|
70
|
+
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
71
|
+
order => '01',
|
72
|
+
}
|
73
|
+
concat::fragment { '2':
|
74
|
+
target => '/tmp/concat/result_file2',
|
75
|
+
source => [ '/tmp/concat/file2', '/tmp/concat/file1' ],
|
76
|
+
order => '01',
|
77
|
+
}
|
78
|
+
concat::fragment { '3':
|
79
|
+
target => '/tmp/concat/result_file3',
|
80
|
+
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
81
|
+
order => '01',
|
82
|
+
}
|
83
|
+
EOS
|
84
|
+
|
85
|
+
context puppet_apply(pp) do
|
86
|
+
its(:stderr) { should be_empty }
|
87
|
+
its(:exit_code) { should_not == 1 }
|
88
|
+
its(:refresh) { should be_nil }
|
89
|
+
its(:stderr) { should be_empty }
|
90
|
+
its(:exit_code) { should be_zero }
|
91
|
+
end
|
92
|
+
describe file('/tmp/concat/result_file1') do
|
93
|
+
it { should be_file }
|
94
|
+
it { should contain 'file1 contents' }
|
95
|
+
it { should_not contain 'file2 contents' }
|
96
|
+
end
|
97
|
+
describe file('/tmp/concat/result_file2') do
|
98
|
+
it { should be_file }
|
99
|
+
it { should contain 'file2 contents' }
|
100
|
+
it { should_not contain 'file1 contents' }
|
101
|
+
end
|
102
|
+
describe file('/tmp/concat/result_file3') do
|
103
|
+
it { should be_file }
|
104
|
+
it { should contain 'file1 contents' }
|
105
|
+
it { should_not contain 'file2 contents' }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'should fail if no match on source.' do
|
110
|
+
before(:all) do
|
111
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
112
|
+
shell('mkdir -p /tmp/concat')
|
113
|
+
shell('/bin/rm -rf /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither')
|
114
|
+
end
|
115
|
+
|
116
|
+
pp = <<-EOS
|
117
|
+
concat { '/tmp/concat/fail_no_source':
|
118
|
+
owner => root,
|
119
|
+
group => root,
|
120
|
+
mode => '0644',
|
121
|
+
}
|
122
|
+
|
123
|
+
concat::fragment { '1':
|
124
|
+
target => '/tmp/concat/fail_no_source',
|
125
|
+
source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
|
126
|
+
order => '01',
|
127
|
+
}
|
128
|
+
EOS
|
129
|
+
|
130
|
+
context puppet_apply(pp) do
|
131
|
+
its(:exit_code) { should_not be_zero }
|
132
|
+
its(:exit_code) { should_not == 1 }
|
133
|
+
its(:refresh) { should be_nil }
|
134
|
+
end
|
135
|
+
describe file('/tmp/concat/fail_no_source') do
|
136
|
+
#FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack.
|
137
|
+
it { should_not be_file }
|
138
|
+
it { should_not be_directory }
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
@@ -0,0 +1,257 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'replacement of' do
|
4
|
+
context 'file' do
|
5
|
+
context 'should not succeed' do
|
6
|
+
before(:all) do
|
7
|
+
shell('mkdir /tmp/concat')
|
8
|
+
shell('echo "file exists" > /tmp/concat/file')
|
9
|
+
end
|
10
|
+
after(:all) do
|
11
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
12
|
+
end
|
13
|
+
|
14
|
+
pp = <<-EOS
|
15
|
+
concat { '/tmp/concat/file':
|
16
|
+
replace => false,
|
17
|
+
}
|
18
|
+
|
19
|
+
concat::fragment { '1':
|
20
|
+
target => '/tmp/concat/file',
|
21
|
+
content => '1',
|
22
|
+
}
|
23
|
+
|
24
|
+
concat::fragment { '2':
|
25
|
+
target => '/tmp/concat/file',
|
26
|
+
content => '2',
|
27
|
+
}
|
28
|
+
EOS
|
29
|
+
|
30
|
+
context puppet_apply(pp) do
|
31
|
+
its(:stderr) { should be_empty }
|
32
|
+
its(:exit_code) { should_not == 1 }
|
33
|
+
its(:refresh) { should be_nil }
|
34
|
+
its(:stderr) { should be_empty }
|
35
|
+
its(:exit_code) { should be_zero }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe file('/tmp/concat/file') do
|
39
|
+
it { should be_file }
|
40
|
+
it { should contain 'file exists' }
|
41
|
+
it { should_not contain '1' }
|
42
|
+
it { should_not contain '2' }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'should succeed' do
|
47
|
+
before(:all) do
|
48
|
+
shell('mkdir /tmp/concat')
|
49
|
+
shell('echo "file exists" > /tmp/concat/file')
|
50
|
+
end
|
51
|
+
after(:all) do
|
52
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
53
|
+
end
|
54
|
+
|
55
|
+
pp = <<-EOS
|
56
|
+
concat { '/tmp/concat/file':
|
57
|
+
replace => true,
|
58
|
+
}
|
59
|
+
|
60
|
+
concat::fragment { '1':
|
61
|
+
target => '/tmp/concat/file',
|
62
|
+
content => '1',
|
63
|
+
}
|
64
|
+
|
65
|
+
concat::fragment { '2':
|
66
|
+
target => '/tmp/concat/file',
|
67
|
+
content => '2',
|
68
|
+
}
|
69
|
+
EOS
|
70
|
+
|
71
|
+
context puppet_apply(pp) do
|
72
|
+
its(:stderr) { should be_empty }
|
73
|
+
its(:exit_code) { should_not == 1 }
|
74
|
+
its(:refresh) { should be_nil }
|
75
|
+
its(:stderr) { should be_empty }
|
76
|
+
its(:exit_code) { should be_zero }
|
77
|
+
end
|
78
|
+
|
79
|
+
describe file('/tmp/concat/file') do
|
80
|
+
it { should be_file }
|
81
|
+
it { should_not contain 'file exists' }
|
82
|
+
it { should contain '1' }
|
83
|
+
it { should contain '2' }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end # file
|
87
|
+
|
88
|
+
context 'symlink' do
|
89
|
+
context 'should not succeed' do
|
90
|
+
# XXX the core puppet file type will replace a symlink with a plain file
|
91
|
+
# when using ensure => present and source => ... but it will not when using
|
92
|
+
# ensure => present and content => ...; this is somewhat confusing behavior
|
93
|
+
before(:all) do
|
94
|
+
shell('mkdir /tmp/concat')
|
95
|
+
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
|
96
|
+
end
|
97
|
+
after(:all) do
|
98
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
99
|
+
end
|
100
|
+
|
101
|
+
pp = <<-EOS
|
102
|
+
concat { '/tmp/concat/file':
|
103
|
+
replace => false,
|
104
|
+
}
|
105
|
+
|
106
|
+
concat::fragment { '1':
|
107
|
+
target => '/tmp/concat/file',
|
108
|
+
content => '1',
|
109
|
+
}
|
110
|
+
|
111
|
+
concat::fragment { '2':
|
112
|
+
target => '/tmp/concat/file',
|
113
|
+
content => '2',
|
114
|
+
}
|
115
|
+
EOS
|
116
|
+
|
117
|
+
context puppet_apply(pp) do
|
118
|
+
its(:stderr) { should be_empty }
|
119
|
+
its(:exit_code) { should_not == 1 }
|
120
|
+
its(:refresh) { should be_nil }
|
121
|
+
its(:stderr) { should be_empty }
|
122
|
+
its(:exit_code) { should be_zero }
|
123
|
+
end
|
124
|
+
|
125
|
+
describe file('/tmp/concat/file') do
|
126
|
+
it { should be_linked_to '/tmp/concat/dangling' }
|
127
|
+
end
|
128
|
+
|
129
|
+
describe file('/tmp/concat/dangling') do
|
130
|
+
# XXX serverspec does not have a matcher for 'exists'
|
131
|
+
it { should_not be_file }
|
132
|
+
it { should_not be_directory }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'should succeed' do
|
137
|
+
# XXX the core puppet file type will replace a symlink with a plain file
|
138
|
+
# when using ensure => present and source => ... but it will not when using
|
139
|
+
# ensure => present and content => ...; this is somewhat confusing behavior
|
140
|
+
before(:all) do
|
141
|
+
shell('mkdir /tmp/concat')
|
142
|
+
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
|
143
|
+
end
|
144
|
+
after(:all) do
|
145
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
146
|
+
end
|
147
|
+
|
148
|
+
pp = <<-EOS
|
149
|
+
concat { '/tmp/concat/file':
|
150
|
+
replace => true,
|
151
|
+
}
|
152
|
+
|
153
|
+
concat::fragment { '1':
|
154
|
+
target => '/tmp/concat/file',
|
155
|
+
content => '1',
|
156
|
+
}
|
157
|
+
|
158
|
+
concat::fragment { '2':
|
159
|
+
target => '/tmp/concat/file',
|
160
|
+
content => '2',
|
161
|
+
}
|
162
|
+
EOS
|
163
|
+
|
164
|
+
context puppet_apply(pp) do
|
165
|
+
its(:stderr) { should be_empty }
|
166
|
+
its(:exit_code) { should_not == 1 }
|
167
|
+
its(:refresh) { should be_nil }
|
168
|
+
its(:stderr) { should be_empty }
|
169
|
+
its(:exit_code) { should be_zero }
|
170
|
+
end
|
171
|
+
|
172
|
+
describe file('/tmp/concat/file') do
|
173
|
+
it { should be_file }
|
174
|
+
it { should contain '1' }
|
175
|
+
it { should contain '2' }
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end # symlink
|
179
|
+
|
180
|
+
context 'directory' do
|
181
|
+
context 'should not succeed' do
|
182
|
+
before(:all) do
|
183
|
+
shell('mkdir -p /tmp/concat/file')
|
184
|
+
end
|
185
|
+
after(:all) do
|
186
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
187
|
+
end
|
188
|
+
|
189
|
+
pp = <<-EOS
|
190
|
+
concat { '/tmp/concat/file': }
|
191
|
+
|
192
|
+
concat::fragment { '1':
|
193
|
+
target => '/tmp/concat/file',
|
194
|
+
content => '1',
|
195
|
+
}
|
196
|
+
|
197
|
+
concat::fragment { '2':
|
198
|
+
target => '/tmp/concat/file',
|
199
|
+
content => '2',
|
200
|
+
}
|
201
|
+
EOS
|
202
|
+
|
203
|
+
context puppet_apply(pp) do
|
204
|
+
its(:stderr) { should =~ /change from directory to file failed/ }
|
205
|
+
its(:exit_code) { should_not == 1 }
|
206
|
+
its(:refresh) { should be_nil }
|
207
|
+
its(:stderr) { should =~ /change from directory to file failed/ }
|
208
|
+
its(:exit_code) { should_not == 1 }
|
209
|
+
end
|
210
|
+
|
211
|
+
describe file('/tmp/concat/file') do
|
212
|
+
it { should be_directory }
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# XXX concat's force param currently enables the creation of empty files when
|
217
|
+
# there are no fragments. The semantics either need to be changed, extended,
|
218
|
+
# or a new param introduced to control directory replacement.
|
219
|
+
context 'should succeed', :pending => 'not yet implemented' do
|
220
|
+
before(:all) do
|
221
|
+
shell('mkdir -p /tmp/concat/file')
|
222
|
+
end
|
223
|
+
after(:all) do
|
224
|
+
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
225
|
+
end
|
226
|
+
|
227
|
+
pp = <<-EOS
|
228
|
+
concat { '/tmp/concat/file':
|
229
|
+
force => true,
|
230
|
+
}
|
231
|
+
|
232
|
+
concat::fragment { '1':
|
233
|
+
target => '/tmp/concat/file',
|
234
|
+
content => '1',
|
235
|
+
}
|
236
|
+
|
237
|
+
concat::fragment { '2':
|
238
|
+
target => '/tmp/concat/file',
|
239
|
+
content => '2',
|
240
|
+
}
|
241
|
+
EOS
|
242
|
+
|
243
|
+
context puppet_apply(pp) do
|
244
|
+
its(:stderr) { should be_empty }
|
245
|
+
its(:exit_code) { should_not == 1 }
|
246
|
+
its(:refresh) { should be_nil }
|
247
|
+
its(:stderr) { should be_empty }
|
248
|
+
its(:exit_code) { should be_zero }
|
249
|
+
end
|
250
|
+
|
251
|
+
describe file('/tmp/concat/file') do
|
252
|
+
it { should be_file }
|
253
|
+
it { should contain '1' }
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end # directory
|
257
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'symbolic name' do
|
4
|
+
pp = <<-EOS
|
5
|
+
concat { 'not_abs_path':
|
6
|
+
path => '/tmp/concat/file',
|
7
|
+
}
|
8
|
+
|
9
|
+
concat::fragment { '1':
|
10
|
+
target => 'not_abs_path',
|
11
|
+
content => '1',
|
12
|
+
order => '01',
|
13
|
+
}
|
14
|
+
|
15
|
+
concat::fragment { '2':
|
16
|
+
target => 'not_abs_path',
|
17
|
+
content => '2',
|
18
|
+
order => '02',
|
19
|
+
}
|
20
|
+
EOS
|
21
|
+
|
22
|
+
context puppet_apply(pp) do
|
23
|
+
its(:stderr) { should be_empty }
|
24
|
+
its(:exit_code) { should_not == 1 }
|
25
|
+
its(:refresh) { should be_nil }
|
26
|
+
its(:stderr) { should be_empty }
|
27
|
+
its(:exit_code) { should be_zero }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe file('/tmp/concat/file') do
|
31
|
+
it { should be_file }
|
32
|
+
it { should contain '1' }
|
33
|
+
it { should contain '2' }
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'concat warn =>' do
|
4
|
+
context 'true should enable default warning message' do
|
5
|
+
pp = <<-EOS
|
6
|
+
concat { '/tmp/concat/file':
|
7
|
+
warn => true,
|
8
|
+
}
|
9
|
+
|
10
|
+
concat::fragment { '1':
|
11
|
+
target => '/tmp/concat/file',
|
12
|
+
content => '1',
|
13
|
+
order => '01',
|
14
|
+
}
|
15
|
+
|
16
|
+
concat::fragment { '2':
|
17
|
+
target => '/tmp/concat/file',
|
18
|
+
content => '2',
|
19
|
+
order => '02',
|
20
|
+
}
|
21
|
+
EOS
|
22
|
+
|
23
|
+
context puppet_apply(pp) do
|
24
|
+
its(:stderr) { should be_empty }
|
25
|
+
its(:exit_code) { should_not == 1 }
|
26
|
+
its(:refresh) { should be_nil }
|
27
|
+
its(:stderr) { should be_empty }
|
28
|
+
its(:exit_code) { should be_zero }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe file('/tmp/concat/file') do
|
32
|
+
it { should be_file }
|
33
|
+
it { should contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
34
|
+
it { should contain '1' }
|
35
|
+
it { should contain '2' }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
context 'false should not enable default warning message' do
|
39
|
+
pp = <<-EOS
|
40
|
+
concat { '/tmp/concat/file':
|
41
|
+
warn => false,
|
42
|
+
}
|
43
|
+
|
44
|
+
concat::fragment { '1':
|
45
|
+
target => '/tmp/concat/file',
|
46
|
+
content => '1',
|
47
|
+
order => '01',
|
48
|
+
}
|
49
|
+
|
50
|
+
concat::fragment { '2':
|
51
|
+
target => '/tmp/concat/file',
|
52
|
+
content => '2',
|
53
|
+
order => '02',
|
54
|
+
}
|
55
|
+
EOS
|
56
|
+
|
57
|
+
context puppet_apply(pp) do
|
58
|
+
its(:stderr) { should be_empty }
|
59
|
+
its(:exit_code) { should_not == 1 }
|
60
|
+
its(:refresh) { should be_nil }
|
61
|
+
its(:stderr) { should be_empty }
|
62
|
+
its(:exit_code) { should be_zero }
|
63
|
+
end
|
64
|
+
|
65
|
+
describe file('/tmp/concat/file') do
|
66
|
+
it { should be_file }
|
67
|
+
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
68
|
+
it { should contain '1' }
|
69
|
+
it { should contain '2' }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
context '# foo should overide default warning message' do
|
73
|
+
pp = <<-EOS
|
74
|
+
concat { '/tmp/concat/file':
|
75
|
+
warn => '# foo',
|
76
|
+
}
|
77
|
+
|
78
|
+
concat::fragment { '1':
|
79
|
+
target => '/tmp/concat/file',
|
80
|
+
content => '1',
|
81
|
+
order => '01',
|
82
|
+
}
|
83
|
+
|
84
|
+
concat::fragment { '2':
|
85
|
+
target => '/tmp/concat/file',
|
86
|
+
content => '2',
|
87
|
+
order => '02',
|
88
|
+
}
|
89
|
+
EOS
|
90
|
+
|
91
|
+
context puppet_apply(pp) do
|
92
|
+
its(:stderr) { should be_empty }
|
93
|
+
its(:exit_code) { should_not == 1 }
|
94
|
+
its(:refresh) { should be_nil }
|
95
|
+
its(:stderr) { should be_empty }
|
96
|
+
its(:exit_code) { should be_zero }
|
97
|
+
end
|
98
|
+
|
99
|
+
describe file('/tmp/concat/file') do
|
100
|
+
it { should be_file }
|
101
|
+
it { should contain '# foo' }
|
102
|
+
it { should contain '1' }
|
103
|
+
it { should contain '2' }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'concat::setup', :type => :class do
|
4
|
+
|
5
|
+
shared_examples 'setup' do |concatdir|
|
6
|
+
concatdir = '/foo' if concatdir.nil?
|
7
|
+
|
8
|
+
let(:facts) {{ :concat_basedir => concatdir }}
|
9
|
+
|
10
|
+
it do
|
11
|
+
should contain_file("#{concatdir}/bin/concatfragments.sh").with({
|
12
|
+
:mode => '0755',
|
13
|
+
:source => 'puppet:///modules/concat/concatfragments.sh',
|
14
|
+
:backup => false,
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
[concatdir, "#{concatdir}/bin"].each do |file|
|
19
|
+
it do
|
20
|
+
should contain_file(file).with({
|
21
|
+
:ensure => 'directory',
|
22
|
+
:mode => '0755',
|
23
|
+
:backup => false,
|
24
|
+
})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'facts' do
|
30
|
+
context 'concat_basedir =>' do
|
31
|
+
context '/foo' do
|
32
|
+
it_behaves_like 'setup', '/foo'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end # facts
|
36
|
+
|
37
|
+
context 'deprecated as a public class' do
|
38
|
+
it 'should create a warning' do
|
39
|
+
pending('rspec-puppet support for testing warning()')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|