puppetlabs/puppet_for_the_win — pull request #19 by jeffmccune (2012-02-28 23:36:16+00:00)
Title: (#12357) Make the MSI write puppet_installer.txt Facts

Without this patch, the 5 critical custom facts every Puppet Enterprise
agent defines are not present on Windows nodes. These facts are:

fact_stomp_port=61613
fact_stomp_server=puppet
fact_is_puppetagent=true
fact_is_puppetmaster=false
fact_is_puppetconsole=false

This patch adds these custom fact values by writing a txt file to
`Puppet[:confdir]/facts.d/puppet_installer.txt` The MSI installer will have
the behavior of writing these facts regardless of the FOSS or Puppet Enterprise
branding.

The stdlib puppet module needs to have a corollary change [1] to actually look
in this directory to pick up these custom facts.

We're taking advantage of the fact that an INI file on windows looks remarkably
like a normal text file of key value pairs separated by an `=` sign. The
`facts_dot_d.rb` custom fact already discards lines that do not contain an `=`
character, so the INI file header poses no problem for us.

This patch fixes the problem by writing the PUPPET_MASTER_HOSTNAME MSI public
property to `fact_stomp_server` entry. The fact_stomp_port entry is hard coded
to 61613, though it could easily be written as a hidden but documented public
property to keep the interview questions to a minimum.

Since the addLine attribute is being employed entries that already exist in the
filesystem will not be overwritten or changed. The file will not be removed
when the package is uninstalled.

[1] https://github.com/puppetlabs/puppetlabs-stdlib/pull/38