Bug #1737
closedReprovisioning of servers does not work with puppet facts in same DB
Description
Hello!
I'm using 0.5-nightly-84fce85c running on activerecord 3.0.10 with a PostgresDB and Puppet 2.7.17.
Puppet and Foreman are sharing their database (of which I am not sure is still a "supported" way).
As Ohad wrote in IRC the standard to save MAC addresses in the DB is lowercase. Unfortunately Puppet passes it's facts (especially the mac address) without case transformation into the database (see https://github.com/puppetlabs/facter/blob/master/lib/facter/macaddress.rb#L16 ).
On Debian (and i guess Ubuntu) this isn't a problem as the macaddress is in lowercase.
On RedHat (tested all versions from 5.2 until 6.3) ifconfig outputs the Macaddress in uppercase letters.
I solved this problem by patching unattended_controller.rb:
diff --git a/app/controllers/unattended_controller.rb b/app/controllers/unattended_controller.rb index f065ecf..082c7dd 100644 --- a/app/controllers/unattended_controller.rb +++ b/app/controllers/unattended_controller.rb @@ -99,6 +99,7 @@ class UnattendedController < ApplicationController begin request.env.keys.each do | header | maclist << request.env[header].split[1].downcase.strip if header =~ /^HTTP_X_RHN_PROVISIONING_MAC_/ + maclist << request.env[header].split[1].upcase.strip if header =~ /^HTTP_X_RHN_PROVISIONING_MAC_/ end rescue => e logger.info "unknown RHN_PROVISIONING header #{e}"
Maybe someone will come up with a better solution but it might help others for now :)
best wishes
Hannes
Updated by Ohad Levy over 12 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset 71b451482bcef12f4c991ef1bb6ce529025f4472.