(#15529) Initialize app settings before all and each test

Adds a new initialize() call to the TestHelper API, designed to be run before
all testing and further loading commences.

It initializes Puppet settings using the proper initialize_app_defaults call
rather than setting items individually, so the settings class correctly states
the app has been initialized.  This then makes the autoloader set up paths as
it queries this value to determine if the libdir and others have been set up
and it can autoload from them.

Patch modified by Josh Cooper <josh@puppetlabs.com>
 (#15529) Initialize settings before executing puppet specs

Previously, Puppet's settings were not initialized until the first
example was executed. Depending on the test being executed, this could
cause errors that $confdir was not initialized. For example, if the
first spec test to be executed contained:

    Puppet::Interface.faces.each do |name|
      it "should ... #{name}" do
        ..
      end
    end

Then the test would blow up, since the call to `faces` happens before
the spec_helper's before each block is executed.

This commit ensures Puppet's application default settings have been
initialized before any test code executes. A similar change will need to
be made in puppet_spec_helper.
Add postflight for OSX packages to add puppet user, group

Previously, users installing the Puppet package for OS X would need to create
their own user and group to run `puppet apply` successfully or to set up a
puppet master. This also was out of line wiht our other puppet packages, which
do create the puppet user and group. This commit adds a postflight script to
the OS X packaging that will create a puppet user and group if they don't
already exist.

Note: this commit depends on packaging changes to install the postflight during
OS X packaging and will be inert until that change is made.
(#18161) Honor CA SRV record for all types of CA requests

For certificate requests, certificate status requests & certificate
revocation list requests puppet used the x-puppet srv record instead of
the x-puppet-ca record.

Adds tests for the issue.
Merge branch 'dalen-srv_ca'

* dalen-srv_ca:
  (#18161) Honor CA SRV record for all types of CA requests
(#18162) Honor fileserver SRV record for file metadata requests

File content requests uses the x-puppet-fileserver SRV record, but file
metadata requests used the x-puppet SRV record.

Adds test for the functionality.
Merge branch 'dalen-file_metadata_srv'

* dalen-file_metadata_srv:
  (#18162) Honor fileserver SRV record for file metadata requests
Merge pull request #1363 from haus/feature/master/add_postflight_for_osx

Add postflight for OSX packages to add puppet user, group
(Maint) Exclude ownership test from windows

Windows does not try to manage ownership of settings files and
directories right now, so this needs to exclude it. Also, since it runs
across agents, it needs to make sure it only does what an agent can do,
which means it can only use "apply" and not "master".
(Maint) Use string for exclusion instead of symbol

The proper way to exclude from a platform is to use a string. The symbol
does not actually exclude (but also doesn't raise an error)
Merge pull request #1332 from joshcooper/ticket/master/15529-reinitialize_app_defaults

(#15529) Reinitialize app defaults before all and each test
Bug #17898 - pkgdmg provider broken since version 2.7.13 under OS X 10.5 Leopard
http://projects.puppetlabs.com/issues/17898

Dir.mktmpdir doesn't exist under Ruby 1.8.6 or older. This adds it, using code from https://github.com/puppetlabs/hiera/pull/47/files which uses code from ruby-1.8.7-p357/lib/ruby/1.8/tmpdir.rb
Merge branch 'mrrcollins-bug17898'

* mrrcollins-bug17898:
  Bug #17898 - pkgdmg provider broken since version 2.7.13 under OS X 10.5 Leopard http://projects.puppetlabs.com/issues/17898
(#17994) Fix wrong (decimal) mode causes sticky bit to be set.

A decimal mode/mask of 755 is clearly wrong; it should have been 0755.
The problem causes the sticky bit (and what not) to be set instead of
what was intended.
Maint: Cleanup spec test

This commit changes the ensure spec to use let blocks and eliminates
stubbing of file resources.
Maint: Remove duplicate tests

Commit 8d212629 duplicated some tests, this commit removes them.
(#17994) Add tests for directory creation

Adds tests to cover when creating directory and mode is specified as
either an octal or symbolic mode.

I was unable to actually create a directory (Dir.mkdir) and then stat it
to verify the mode was set correctly, because on some ruby
implementations, Dir.mkdir ignores special mode bits. On my Mac, for
example, calling Dir.mkdir(path, 01777), results in mode 00777. However,
puppet does the right thing, because it calls `property_fix` on the file
type, which goes through each property and ensures each is in sync.

Since the sticky-bit behavior is system-dependent, I'm setting an
expectation on the Dir object, and that at least detects the bug
reported in #17994.
(#17994) Rework symbolic mode acceptance test

Previously, the acceptance test was only testing that puppet could
modify the mode of an existing file/dir, but not when creating them. As
a result, #17994 went undetected.

This commit adds tests for that as well as adding test coverage for
other cases, such as the user 'a', which is short-hand for 'ugo', the
operation '-', permissions 's' and 't', and the absence of any
permission (o=).

In the process it uncovered a bug, when puppet applies ugo=rwxs to a
file, it results in 07777 instead of 06777. This is filed as #18355

One important thing to note about symbolic modes is that puppet always
uses a umask of 022 when applying the mode to file/directories that it
creates. When only a partial symbolic mode is specified, e.g. u=r, the
resulting mode will be 0444 (file) 0455 (directory), which may not be
what you expect. To ensure you don't accidentally grant more permissions
than intended (such as when setting root's umask to 077), it is
recommended that you fully specify the symbolic mode, e.g. 'u=r,go='

Paired-with: Andy Parker <andy@puppetlabs.com>
Merge branch 'ticket/master/17994-wrong-mode-not-octal'

* ticket/master/17994-wrong-mode-not-octal:
  (#17994) Rework symbolic mode acceptance test
  (#17994) Add tests for directory creation
  Maint: Remove duplicate tests
  Maint: Cleanup spec test
  (#17994) Fix wrong (decimal) mode causes sticky bit to be set.
(#17448/#17449/#18045) Update fileserver.conf and auth.conf examples

These files still referred to the regime whereby access control lived in
both files and auth.conf usually delegated to fileserver.conf, except
when it didn't. In the meantime, we've improved auth.conf and partially
broken fileserver.conf, and in conversations with the core team, it's
become clear that we don't necessarily WANT to fix fileserver.conf,
especially if not doing so will lead to better and more centralized
access control.

Unfortunately, an awkward period seems unavoidable. This commit
attempts to describe what users SHOULD do and give enough hints that it
will be easy to do so, at the cost of a certain windiness.

NOTE ESPECIALLY that we're now using the word "deprecated," as the
warnings-and-prefs-based deprecation plan outlined at #18045 has been accepted.