Puppet: System Administration Automated

Support

Ticket #276 (closed enhancement: invalid)

Opened 2 years ago

Last modified 2 years ago

patch - fqdn fact

Reported by: mccune.jeff@gmail.com Assigned to: luke
Priority: normal Milestone:
Component: library Version:
Severity: normal Keywords: patch fqdn facter
Cc: Triage Stage:
Attached Patches: Complexity:

Description

This patch augments the hostname and domain facts, providing a fully qualified domain name fact. This fact will aid the creation of a configurable "nodeid" client option to fact mapping.

Index: lib/facter.rb
===================================================================
--- lib/facter.rb	(revision 165)
+++ lib/facter.rb	(working copy)
@@ -773,6 +773,23 @@
             end
         end
 
+        Facter.add("FQDN") do
+            setcode do
+                fqdn = nil
+                name = Resolution.exec('hostname') or nil
+                if name
+                    if name =~ /^([\w-]+)\.(.+)$/
+                        fqdn = name
+                    else
+                        nil
+                    end
+                    fqdn
+                else
+                    nil
+                end
+            end
+        end
+
         Facter.add("IPAddress") do
             setldapname "iphostnumber"
             setcode do

Attachments

facter_fqdn.patch (0.8 kB) - added by puppet on 09/15/06 23:04:25.
patch - fqdn patch - output of svn diff

Change History

09/15/06 23:04:25 changed by puppet

  • attachment facter_fqdn.patch added.

patch - fqdn patch - output of svn diff

09/15/06 23:19:31 changed by puppet

  • status changed from new to closed.
  • resolution set to invalid.