]> gitweb.fluxo.info Git - puppet-dhcp.git/commitdiff
switch from common::concatfilepart to concat[1]
authorMathieu Bornoz <mathieu.bornoz@camptocamp.com>
Thu, 2 Aug 2012 07:30:21 +0000 (09:30 +0200)
committerMathieu Bornoz <mathieu.bornoz@camptocamp.com>
Thu, 2 Aug 2012 07:30:21 +0000 (09:30 +0200)
[1] https://github.com/camptocamp/puppet-concat

manifests/host.pp
manifests/server/base.pp
manifests/server/debian.pp
manifests/shared-network.pp
manifests/subnet.pp

index 160df633345b13e207cf6c79a80b1043ad68da7a..d946ae969163c7967d8e9960033e9c83dd9e31d9 100644 (file)
@@ -11,10 +11,10 @@ Arguments:
 */
 define dhcp::host($ensure=present,$mac,$subnet,$fixed_address=false, $options=false) {
   include dhcp::params
-  common::concatfilepart {"dhcp.host.$name":
-    ensure => $ensure,
-    notify => Service["dhcpd"],
-    file   => "${dhcp::params::config_dir}/hosts.d/${subnet}.conf",
+  concat::fragment {"dhcp.host.$name":
+    ensure  => $ensure,
+    target  => "${dhcp::params::config_dir}/hosts.d/${subnet}.conf",
     content => template("dhcp/host.conf.erb"),
+    notify  => Service["dhcpd"],
   }
 }
index 1725b36d4e15651f47ba88af5f39c2c10a72f874..53cbd7049658a6e0f47ea69de0ae83dd2c148e32 100644 (file)
@@ -7,7 +7,10 @@ This class should be inherited in dhcp::server::$operatingsystem.
 
 */
 class dhcp::server::base {
+
   include dhcp::params
+  include concat::setup
+  
   package {"dhcp-server":
     ensure => present,
     name   => $dhcp::params::srv_dhcpd,
@@ -20,9 +23,15 @@ class dhcp::server::base {
     require => Package["dhcp-server"],
   }
 
-  common::concatfilepart {"00.dhcp.server.base":
-    file    => "${dhcp::params::config_dir}/dhcpd.conf",
+  concat {"${dhcp::params::config_dir}/dhcpd.conf":
+    owner => root,
+    group => root,
+    mode  => '0644',
+  }
+
+  concat::fragment {"00.dhcp.server.base":
     ensure  => present,
+    target  => "${dhcp::params::config_dir}/dhcpd.conf",
     require => Package["dhcp-server"],
     notify  => Service["dhcpd"],
   }
index 976238411453a86344274eba6ec75f734baa8f6f..3cc750872490e2b1ab8131f985d435d98fbb93c4 100644 (file)
@@ -8,7 +8,7 @@ This class should not be included as is, please include "dhcp::server" instead.
 */
 class dhcp::server::debian inherits dhcp::server::base {
 
-  Common::Concatfilepart["00.dhcp.server.base"] {
+  Concat::Fragment["00.dhcp.server.base"] {
     content => template('dhcp/dhcpd.conf.debian.erb'),
   }
 
index 9e1e779876de010a3d62c63f77a9129378635185..2154d37af9994508e600cdcd1e652902382bd2ad 100644 (file)
@@ -13,9 +13,9 @@ Warnings:
 */
 define dhcp::shared-network($ensure=present, $subnets=[]) {
   include dhcp::params
-  common::concatfilepart {"shared-${name}":
+  concat::fragment {"shared-${name}":
     ensure  => $ensure,
-    file    => "${dhcp::params::config_dir}/dhcpd.conf",
+    target  => "${dhcp::params::config_dir}/dhcpd.conf",
     content => template("dhcp/shared-network.erb"),
     require => Dhcp::Subnet[$subnets],
   }
index c0f865bd7bf512466e89e11c6f51fa53098abaa0..15afd53bb4a10e2d98849fa09fefbff3abc9abb8 100644 (file)
@@ -37,7 +37,11 @@ define dhcp::subnet(
   $is_shared=false) {
   include dhcp::params
 
-  $to_include = "${dhcp::params::config_dir}/hosts.d/${name}.conf"
+  concat {"${dhcp::params::config_dir}/hosts.d/${name}.conf":
+    owner => root,
+    group => root,
+    mode  => '0644',
+  }
 
   file {"${dhcp::params::config_dir}/subnets/${name}.conf":
     ensure => $ensure,
@@ -48,29 +52,29 @@ define dhcp::subnet(
   }
   
   if ! $is_shared {
-    common::concatfilepart {"dhcp.${name}":
-      file => "${dhcp::params::config_dir}/dhcpd.conf",
-      ensure => $ensure,
+    concat::fragment {"dhcp.${name}":
+      ensure  => $ensure,
+      target  => "${dhcp::params::config_dir}/dhcpd.conf",
       content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n",
     }
   } else {
-    common::concatfilepart {"dhcp.${name}":
-      file => "${dhcp::params::config_dir}/dhcpd.conf",
-      ensure => absent,
+    concat::fragment {"dhcp.${name}":
+      ensure  => absent,
+      target  => "${dhcp::params::config_dir}/dhcpd.conf",
       content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n",
     }
 
   }
 
-  common::concatfilepart {"subnet.${name}.hosts":
-    file => "${dhcp::params::config_dir}/dhcpd.conf",
-    ensure => $ensure,
+  concat::fragment {"subnet.${name}.hosts":
+    ensure  => $ensure,
+    target  => "${dhcp::params::config_dir}/dhcpd.conf",
     content => "include \"${dhcp::params::config_dir}/hosts.d/${name}.conf\";\n",
   }
 
-  common::concatfilepart {"00.dhcp.${name}.base":
-    file   => $to_include,
-    ensure => $ensure,
+  concat::fragment {"00.dhcp.${name}.base":
+    ensure  => $ensure,
+    target  => "${dhcp::params::config_dir}/hosts.d/${name}.conf",
     content => "# File managed by puppet\n",
   }
 }