Project

General

Profile

Bug #1737

Reprovisioning of servers does not work with puppet facts in same DB

Added by Hannes Schaller over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

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

Associated revisions

Revision 71b45148 (diff)
Added by Ohad Levy over 10 years ago

fixes #1737 - make sure mac based matching are case insensetive

History

#1 Updated by Ohad Levy over 10 years ago

  • Target version set to 1.0

#2 Updated by Ohad Levy over 10 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF