Closed ppouliot closed 8 years ago
@ppouliot What does the code you're using look like? Are you passing the mac address within quotes? It looks like its turning the mac address into a number
I'm trying to recreate in tests and I can get it to fail.
It'd be easy enough to fix IMO:
hardware ethernet <%= @mac.to_s.upcase %>;
I'm trying to recreate in tests and I can get it to fail.
@petems You can get it to fail? I've not been able to yet.
Typo, shoudve been cant :)
So we're using hiera to push all data into the module. No quotes used on the mac address in the yaml files.
Hiera i'm using is as follows:
dhcp::dnsdomain:
- contoso.ltd
- 0.168.192.in-addr.arpa
dhcp::nameservers:
- 192.168.0.1
- 192.168.0.2
dhcp::ntpservers:
- bonehed.lsc.mit.edu
dhcp::interfaces:
- eth0
dhcpdata:
contoso.ltd:
failover: dhcp-failover
network: 192.168.0.0
mask: 255.255.255.0
gateway: 192.168.0.254
range:
- 192.168.0.100
- 192.168.0.220
options:
- domain-name-servers 192.168.0.1
- domain-name "contoso.ltd"
- ntp-servers bonehed.lcs.mit.edu
parameters:
- ddns-domainname "contoso.ltd, 0.168.192.in-addr.arpa"
static_leases:
myhost:
mac: 00:1a:2b:3c:4d:5e
ip: 192.168.0.3
# Uncomment this entry to test mac addresses that are only numeric
# allnumericmac:
# mac: 00:07:43:14:15
Ah, that would explain it. You might want to obfuscate the data btw, just in case.
Can you try putting quotes around the mac addresses in the yaml?
so I'm trying that now, here's the output from data, and it's not actually my working data, it's just basics for testing the modules. I've got 15000 lines of hiera we feed into the module with our specifics.
When I add quotes to my code defining the record I get this as output in the dhcpd.hosts file.
host allnumericmac { hardware ethernet 6535303; fixed-address 192.168.0.4; ddns-hostname "allnumericmac"; }
So quotes in the hiera appears to work. Output after adding quotes for the record is as follows.
host allnumericmac { hardware ethernet 00:07:43:14:15:30; fixed-address 192.168.0.4; ddns-hostname "allnumericmac"; }
Now https://github.com/voxpupuli/puppet-dhcp/issues/110 is merged, can this be closed?
@ekohl I think so. @ppouliot has a solution and we've got extra validation in the module from now on.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
When a host mac address contains only numeric values processing fails. For example: mac: 00:07:43:14:16:70
What are you seeing
The following line in the template lcoated in puppetlabs-dhcp/templates/dhcpd.host.erb causes the issue, because it can't do the operation when only numeric values exist. hardware ethernet <%= @mac.upcase %>;
What behaviour did you expect instead
It should work on any valid mac address.
Output log
Any additional information you'd like to impart