(PUP-3322) Add debugging to appdmg provider

I was trying to install Scratch[1] using boxen[2]. The appdmg isn’t in
the expected format, so this failed. I had to poke around a bit to
understand why that was happening. This change captures that knowledge.

[1] http://scratch.mit.edu/scratch_1.4/
[2] https://boxen.github.com/
(PUP-3267) Remove --listen functionality from agent
(PUP-3267) Remove puppet kick application
(PUP-3267) Remove Puppet::Run and terminii

Puppet::Run was only used by puppet kick; since we've removed puppet
kick this code is no longer in use and can be removed.
(PUP-3457) don't switch uid/gid if already the same

if the uid/gid is already the one we're supposed to switch to, do not
attempt to switch, just return.

fix a now failing #asuser rspec test, thanks @kylog!
add two rspec tests checking for the new functionality.
(PUP-3267) Remove puppet resource for remote hosts

The removal of `puppet agent --listen` means that it's no longer
possible to use `puppet resource` with a remote host. This commit
removes the relevant functionality in the resource command, the
resource REST terminus, and disables remote requests for the remaining
terminii.
(PUP-3267) Remove acceptance tests for Puppet kick
(PUP-3267) Remove :listen and :puppetport settings

Both of these settings were only used for `puppet agent --listen` and
are no longer in use.
(PUP-2613) Update source_permissions help message

Changes the help text to identify :ignore as the default.
(PUP-2613) Revert change to spec test

Prior to commit 6196e75b0, file_spec.rb asserted puppet would by
default apply the sourced file's owner, group, and mode to the file
resource.

Commit 6196e75b0 changed the default behavior of `source_permissions`
from `use` to `ignore`. This caused the test's precondition to no
longer be true.

In the same commit, the spec was modified to assert that the source
mode was no longer applied to the file, but that changed the meaning
of the test. The modified test worked when running as a regular user,
but failed when running in jenkins as LocalSystem.

When puppet manages file content, it creates a
Puppet::FileSystem::Uniquefile, and renames the file. The permissions
assigned to the group depend on the default DACL for the user.

When running as a normal user, the group is "None" and the file was
created with read permissions (0x1201bf), missing DELETE (0x10000),
WRITE_DAC (0x40000), and WRITE_OWNER (0x80000). This caused puppet
to report the mode as 0740, which didn't match 0770, so the test
passed.

When run in jenkins as LocalSystem, the group is "SYSTEM" and puppet
will always ensure that SYSTEM has full control. This caused puppet to
report the mode as 0770, which caused the test to fail.

This commit reverts the change to the spec test, and specifies the
precondition `source_permissions => use`. The test will eventually be
removed in PUP-2609, since we're removing `use` behavior on Windows.
(PUP-2613) Specify `use` precondition

Previously, a few tests relied on source_permissions defaulting to
`use`, and broke in CI when the default changed.

This commit ensures we specify the necessary precondition for the test
to pass.

When PUP-2609 is implemented, we can remove these tests.
Merge remote-tracking branch 'origin/ticket/master/PUP-2613-use-source-permissions'

* origin/ticket/master/PUP-2613-use-source-permissions:
  (PUP-2613) Specify `use` precondition
  (PUP-2613) Revert change to spec test
Merge pull request #3221 from MikaelSmith/task/master/PUP-2613-update-help-message

(PUP-2613) Update source_permissions help message
Merge pull request #3207 from adrienthebo/removal/master/pup-3267-remove-puppet-kick

Removal/master/pup 3267 remove puppet kick
PUP-3492: enabled Upstart as a service provider for linux Mint

Change-Id: I3df5054e3cc125718f5f6e99a8ad73a962df8501
Merge pull request #3220 from TimWSpence/PUP-3492

PUP-3492: enabled Upstart as a service provider for linux Mint
Merge pull request #3192 from igalic/no-suid-if-eq

(PUP-3457) don't switch uid/gid if already the same
Merge pull request #3110 from jabley/feature/appdmg-debugging

(PUP-3322) Add debugging to appdmg provider
(PUP-3505) Fix problem with passing explicit undef res parameter

With the future parser in effect and a resource attribute is undef the
logic that checks for missing arguments did not report the parameter.
This in turn led to that the logic that either fails the operation, or
assigns the default value to completely skip that parameter/argument.
Subsequently a reference of that parameter ended up picking the same
variable from an outer context.

The fix is to equate a nil value (4x) with an :undef value (for 3x) when
computing the missing arguments.

A test is added that tests the functionality.
(PUP-3500) Avoid cacheing environment values when handling setting hooks

Environment in parse_config is being used to ensure that settings in the
current run_mode's environment are checked for hooks, and to handle
hooks that are simply on_write.  In this latter case, the code looks up
the value of the setting from all available elements of the setting's
search_path including the current environment layer.

But if directory environments are in use, their environment settings
cannot be looked up at this early point in settings initialization (we
have no environment loaders), and the consequence is that we end up with
a ChainedValues instance cached in the Settings @values[:env][:runmode]
that does not have a section for :env.  This then blocks resolution of
the real environment settings at a later date.

The fix in this patch is to construct a temporary ChainedValues instance
for the lookup rather than invoking value(), thus avoiding the cacheing.

Since none of the documented environment settings has a hook, we were
very tempted to yank out the environment handling entirely, but this
would leave us with yet more odd behavior if a hook was added to an
environment setting in the 3.7.x series for some unknowable reason, and
it was then set in a legacy environment block.

* the question of how to handle Setting hooks for directory environment
settings is open in PUP-3507

Paired-with: Britt Gresham <britt@puppetlabs.com>