aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-12 10:50:24 +0200
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-12 10:50:24 +0200
commitf7025518512c0bf8d63f413f7be78347fedee9f4 (patch)
tree309a353b9b9e30023d505b1985627bfbeb249749
parent53346e4314aed349290661cbe70c97ab573ea9bc (diff)
downloadpuppet-dhcp-f7025518512c0bf8d63f413f7be78347fedee9f4.tar.gz
puppet-dhcp-f7025518512c0bf8d63f413f7be78347fedee9f4.tar.bz2
Test target for concat::fragment in dhcp::hosts
-rw-r--r--manifests/hosts.pp8
-rw-r--r--spec/defines/dhcp_hosts_spec.rb7
2 files changed, 9 insertions, 6 deletions
diff --git a/manifests/hosts.pp b/manifests/hosts.pp
index f8e5faf..676d507 100644
--- a/manifests/hosts.pp
+++ b/manifests/hosts.pp
@@ -4,15 +4,14 @@
#
# Arguments
# $template: dhcp host template - default: 'dhcp/host.conf.erb'
-# $global_options: global options for the whole bunch of hosts.
+# $global_options: an array of global options for the whole bunch of hosts.
# you may override it per host, setting the host "options"
# directly in the hash.
# $subnet: targeted subnet
# $hash_data: hash containing data - default form:
# {
# <host1> => {
-# options => false,
-# fixed_address => false,
+# options => ['opt1', 'opt2'],
# interfaces => {
# eth0 => 'mac-address',
# eth1 => 'mac-address',
@@ -22,8 +21,7 @@
# }
# },
# <host2> => {
-# options => false,
-# fixed_address => false,
+# fixed_address => 'foo.example.com',
# interfaces => {
# eth0 => 'mac-address',
# eth1 => 'mac-address',
diff --git a/spec/defines/dhcp_hosts_spec.rb b/spec/defines/dhcp_hosts_spec.rb
index c8face6..f5f44ca 100644
--- a/spec/defines/dhcp_hosts_spec.rb
+++ b/spec/defines/dhcp_hosts_spec.rb
@@ -255,6 +255,7 @@ describe 'dhcp::hosts' do
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /fixed-address host1;/
) }
end
@@ -273,6 +274,7 @@ describe 'dhcp::hosts' do
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /foo;\nbar;\n/
) }
end
@@ -292,6 +294,7 @@ describe 'dhcp::hosts' do
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /baz;\n/
) }
end
@@ -331,6 +334,7 @@ describe 'dhcp::hosts' do
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /foo;\nbar;\n/
) }
end
@@ -355,7 +359,8 @@ describe 'dhcp::hosts' do
:subnet => '1.2.3.4'
} }
- it { should contain_concat__fragment('dhcp.host.My hosts').with_content(
+ it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf').with_content(
/host host1-eth0 \{\n hardware ethernet 00:11:22:33:44:55;\n fixed-address host1;\n\}/).with_content(
/host host1-wlan0 \{\n hardware ethernet 00:aa:bb:44:55:ff;\n fixed-address host1;\n\}/).with_content(
/host host2-eth1 \{\n hardware ethernet 00:11:af:33:44:55;\n fixed-address foo\.example\.com;\n opt1;\n\}/)