Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow dhcp to run without domain-name-servers option #105

Open
sircubbi opened this issue Aug 26, 2016 · 1 comment
Open

allow dhcp to run without domain-name-servers option #105

sircubbi opened this issue Aug 26, 2016 · 1 comment
Labels
needs-feedback Further information is requested

Comments

@sircubbi
Copy link
Contributor

sircubbi commented Aug 26, 2016

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: PE 2016.2.1
  • Ruby: 1.8.7.374
  • Distribution: CentOS 6
  • Module version: 0.4.0

How to reproduce (e.g Puppet code you use)

class { "dhcp":
  [...other options...]
  nameservers        => [],
  dnsdomain          => [],
}

What are you seeing

dhcp does not run, because option domain-name-servers is empty (if you set nameservers to undef instead it will add the google nameservers)

What behaviour did you expect instead

generate a dhcpd.conf without "option domain-name-servers" and "option domain-name"

Any additional information you'd like to impart

simple fix would be the following:

diff --git a/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb b/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb
index 9f12b2a..bae1d36 100644
--- a/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb
+++ b/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb
@@ -13,8 +13,12 @@ log-facility <%= @logfacility %>;
 # ----------
 # Options
 # ----------
+<% if @dnsdomain_real and !@dnsdomain_real.empty? -%>
 option domain-name "<%= @dnsdomain_real.first %>";
+<% end -%>
+<% if @nameservers and @nameservers.is_a? Array and !@nameservers.empty? -%>
 option domain-name-servers <%= @nameservers.join(', ') %>;
+<% end -%>
 option fqdn.no-client-update on;  # set the "O" and "S" flag bits
 option fqdn.rcode2 255;
 option pxegrub code 150 = text;

however, properly allow to supply undef to those options would be better (but might break the usage for people who would like to have the google-servers as default). At least there need to be the possibility to not supply nameservers at all.

@vStone
Copy link
Contributor

vStone commented Jul 27, 2018

I would vote to change the default behaviour and not provide any default dns servers at all. These days, people should be able to configure this themselves with little to no effort using hiera.

We probably should bump the major version after this though.

@vStone vStone added the needs-feedback Further information is requested label Jul 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants