Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
Fixes #7571: Change hostname source to prefer FQDN over RUDDER_HOSTNAME
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceMacBuche committed Dec 8, 2015
1 parent 3ce66f3 commit 5127c3f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class FusionReportUnmarshaller(
processHostname(fullReport, doc)
}

// Use RUDDER/HOSTNAME first and if missing OS/FQDN
// First use OS/FQDN and if missing or invalid use RUDDER/HOSTNAME
def processHostname (report : InventoryReport, xml : NodeSeq) : Box[InventoryReport] = {

def updateHostname(hostname : String ) = {
Expand All @@ -240,10 +240,10 @@ class FusionReportUnmarshaller(
}

(optText(xml \\ "RUDDER" \ "HOSTNAME"), optText(xml \\ "OPERATINGSYSTEM" \ "FQDN")) match {
// Rudder tag
case (Some(hostname),_) if validHostname(hostname) => Full(updateHostname(hostname))
// OS tag
case (_,Some(hostname)) if validHostname(hostname) => Full(updateHostname(hostname))
// Rudder tag
case (Some(hostname),_) if validHostname(hostname) => Full(updateHostname(hostname))
case (None,None) => Failure("Hostname could not be found in inventory (RUDDER/HOSTNAME and OPERATINGSYSTEM/FQDN are missing)")
}
}
Expand Down

0 comments on commit 5127c3f

Please sign in to comment.