diff --git a/Gemfile b/Gemfile index 4639be09..f8fcf475 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,6 @@ gem 'rspec-puppet', '~> 2.3' gem 'rspec-puppet-facts', '>= 1.7' gem 'puppetlabs_spec_helper', '>= 2.1.1' gem 'puppet-lint', '>= 2' -gem 'puppet-lint-absolute_classname-check' gem 'puppet-lint-classes_and_types_beginning_with_digits-check' gem 'puppet-lint-empty_string-check' gem 'puppet-lint-file_ensure-check' diff --git a/examples/init.pp b/examples/init.pp index 50c69059..93bef229 100644 --- a/examples/init.pp +++ b/examples/init.pp @@ -1,19 +1,19 @@ $ddnskeyname = 'dhcp_updater' -class { '::dhcp': +class { 'dhcp': dnsdomain => [ 'example.com', '1.1.10.in-addr.arpa', ], nameservers => ['10.1.1.10'], interfaces => ['eth0'], - dnsupdatekey => "/etc/bind/keys.d/${::ddnskeyname}", - require => Bind::Key[$::ddnskeyname], + dnsupdatekey => "/etc/bind/keys.d/${ddnskeyname}", + require => Bind::Key[$ddnskeyname], pxeserver => '10.1.1.5', pxefilename => 'pxelinux.0', } -class { '::dhcp::failover': +class { 'dhcp::failover': role => 'primary', peer_address => '10.1.1.20', } diff --git a/manifests/dhcp_class.pp b/manifests/dhcp_class.pp index fdc012d6..422fcda9 100644 --- a/manifests/dhcp_class.pp +++ b/manifests/dhcp_class.pp @@ -2,7 +2,7 @@ Variant[Array[String], String] $parameters, ) { concat::fragment { "dhcp.conf+50_${name}.dhcp": - target => "${::dhcp::dhcp_dir}/dhcpd.conf", + target => "${dhcp::dhcp_dir}/dhcpd.conf", content => template('dhcp/dhcpd.class.erb'), order => "50-${name}", } diff --git a/manifests/disable.pp b/manifests/disable.pp index 2d66795c..ccfb9c07 100644 --- a/manifests/disable.pp +++ b/manifests/disable.pp @@ -2,10 +2,10 @@ # Remove and Disable the DHCP server # ---------- class dhcp::disable { - include ::dhcp::params + include dhcp::params - $packagename = $::dhcp::params::packagename - $servicename = $::dhcp::params::servicename + $packagename = $dhcp::params::packagename + $servicename = $dhcp::params::servicename package { $packagename: ensure => absent, diff --git a/manifests/failover.pp b/manifests/failover.pp index 39c0cc2f..e38b1f0d 100644 --- a/manifests/failover.pp +++ b/manifests/failover.pp @@ -1,7 +1,7 @@ class dhcp::failover ( String $peer_address, Enum['primary', 'secondary'] $role = 'primary', - String $address = $::ipaddress, + String $address = $facts['ipaddress'], Variant[Integer[0, 65535], String] $port = 519, Variant[Integer[0], String] $max_response_delay = 30, Variant[Integer[0], String] $max_unacked_updates = 10, @@ -11,10 +11,10 @@ Optional[String] $omapi_key = undef, ) { - include ::dhcp + include dhcp concat::fragment { 'dhcp.conf+10_failover.dhcp': - target => "${::dhcp::dhcp_dir}/dhcpd.conf", + target => "${dhcp::dhcp_dir}/dhcpd.conf", content => template('dhcp/dhcpd.conf.failover.erb'), order => '10', } diff --git a/manifests/host.pp b/manifests/host.pp index e5b45974..3aa99500 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -7,7 +7,7 @@ $host = $name concat::fragment { "dhcp.hosts+10_${name}.hosts": - target => "${::dhcp::dhcp_dir}/dhcpd.hosts", + target => "${dhcp::dhcp_dir}/dhcpd.hosts", content => template('dhcp/dhcpd.host.erb'), order => "10-${name}", } diff --git a/manifests/init.pp b/manifests/init.pp index b41f026d..40fc5d25 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -69,7 +69,7 @@ } # Only debian and ubuntu have this style of defaults for startup. - case $::osfamily { + case $facts['osfamily'] { 'Debian': { file{ '/etc/default/isc-dhcp-server': ensure => file, @@ -82,8 +82,8 @@ } } 'RedHat': { - if versioncmp($::operatingsystemmajrelease, '7') >= 0 { - include ::systemd + if versioncmp($facts['operatingsystemmajrelease'], '7') >= 0 { + include systemd systemd::dropin_file { 'interfaces.conf': unit => 'dhcpd.service', content => template('dhcp/redhat/systemd-dropin.conf.erb'), diff --git a/manifests/params.pp b/manifests/params.pp index e1c25a8a..010243e8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,9 +1,9 @@ class dhcp::params { - $dnsdomain = [$::domain] + $dnsdomain = [$facts['domain']] $pxefilename = 'pxelinux.0' - case $::osfamily { + case $facts['osfamily'] { 'Debian': { $dhcp_dir = '/etc/dhcp' $packagename = 'isc-dhcp-server' @@ -37,7 +37,7 @@ $packagename = 'dhcp' $servicename = 'dhcpd' $root_group = 'root' - if $::operatingsystemrelease =~ /^[0-6]\./ { + if $facts['operatingsystemrelease'] =~ /^[0-6]\./ { $bootfiles = { '00:07' => 'grub/grubx64.efi', '00:09' => 'grub/grubx64.efi', @@ -52,7 +52,7 @@ } default: { - fail("${::hostname}: This module does not support osfamily ${::osfamily}") + fail("${facts['hostname']}: This module does not support osfamily ${facts['osfamily']}") } } } diff --git a/manifests/pool.pp b/manifests/pool.pp index 7a7339a4..48e3ce64 100644 --- a/manifests/pool.pp +++ b/manifests/pool.pp @@ -19,7 +19,7 @@ ) { concat::fragment { "dhcp.conf+70_${name}.dhcp": - target => "${::dhcp::dhcp_dir}/dhcpd.conf", + target => "${dhcp::dhcp_dir}/dhcpd.conf", content => template('dhcp/dhcpd.pool.erb'), order => "70-${name}", } diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 6842a856..7b68b4df 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -18,18 +18,18 @@ let(:pp) do <<-EOS - $interface = $::facts['networking']['interfaces'][#{interface}] + $interface = $facts['networking']['interfaces'][#{interface}] - class { '::dhcp': + class { 'dhcp': interfaces => ['#{interface}'], } - ::dhcp::pool { "default subnet": + dhcp::pool { "default subnet": network => $interface['network'], mask => $interface['netmask'], } - ::dhcp::host { $::fqdn: + dhcp::host { $facts['fqdn']: ip => $interface['ip'], mac => $interface['mac'], } diff --git a/spec/acceptance/include_spec.rb b/spec/acceptance/include_spec.rb index 3e63ec4b..1df35cf5 100644 --- a/spec/acceptance/include_spec.rb +++ b/spec/acceptance/include_spec.rb @@ -18,18 +18,18 @@ let(:pp) do <<-EOS - $interface = $::facts['networking']['interfaces'][#{interface}] + $interface = $facts['networking']['interfaces'][#{interface}] file { '/etc/dhcp.include': ensure => file, } - class { '::dhcp': + class { 'dhcp': interfaces => ['#{interface}'], includes => '/etc/dhcp.include', } - ::dhcp::pool { "default subnet": + dhcp::pool { "default subnet": network => $interface['network'], mask => $interface['netmask'], }