Puppet: System Administration Automated

Support

Ticket #1133: puppet_node_name.diff

File puppet_node_name.diff, 2.3 kB (added by johnf, 9 months ago)

puppet_node_name.diff

  • a/lib/puppet/defaults.rb

    old new  
    327327        :masterport => [8140, "Which port puppetmasterd listens on."], 
    328328        :parseonly => [false, "Just check the syntax of the manifests."], 
    329329        :node_name => ["cert", "How the puppetmaster determines the client's identity  
    330            and sets the 'hostname' fact for use in the manifest, in particular  
    331            for determining which 'node' statement applies to the client.  
     330           and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest,  
     331           in particular for determining which 'node' statement applies to the client.  
    332332           Possible values are 'cert' (use the subject's CN in the client's  
    333333           certificate) and 'facter' (use the hostname that the client  
    334334           reported in its facts)"], 
  • a/lib/puppet/network/handler/master.rb

    old new  
    8181            clientip = facts["ipaddress"] 
    8282            if Puppet[:node_name] == 'cert' 
    8383                if name 
     84                    facts["fqdn"] = client 
     85                    facts["hostname"], facts["domain"] = client.split('.', 2) 
    8486                    client = name 
    8587                end 
    8688                if ip 
  • a/test/network/handler/master.rb

    old new  
    7676        Puppet[:node_name] = "cert" 
    7777 
    7878        # Make sure we get the fact data back when nothing is set 
    79         facts = {"hostname" => "fact_hostname", "ipaddress" => "fact_ip"} 
    80         certname = "cert_hostname" 
     79        facts = { 
     80            "hostname" => "fact_hostname", 
     81            "domain" => "fact_domain", 
     82            "fqdn" => "fact_hostname.fact_domain", 
     83            "ipaddress" => "fact_ip" 
     84        } 
     85        certhostname = "cert_hostname" 
     86        certdomain = "cert_domain" 
     87        certname = certhostname + "." + certdomain 
    8188        certip = "cert_ip" 
    8289 
    8390        resname, resip = master.send(:clientname, nil, nil, facts)