(#13117) Fix selmodule error on each_lines

This adds a test for selmodversion_loaded (which previously had no coverage at
all) and fixes the conflicting use of readline and each_line by choosing just
one.
Stub execpipe using StringIO

The real execpipe yields an IO object so this is more realistic as a test.
(#7749) Reduce weird scope cycles when bootstrapping settings

This commit is a first step towards cleaning up the way that settings
are loaded when puppet is bootstrapped.

A major symptom of the old load order was that if you do a 'require "puppet"'
too early in your code, everything will break because the defaults will
be screwed up.

This commit does not represent an ideal (or probably even a 'good') solution,
it just tweaks a few things in order to make a more meaningful cleanup
possible.

Specifically:

* Makes the ":mutable_defaults" class of settings more sticky, so that they
  are actually used when interpolating settings
* Simplify resolution of run modes for legacy application names; previous
  implementation required *ALL* available apps to actually be fully parsed
  and loaded in order to resolve these, and that introduced some challenging
  bootstrap dependency cycles.
Add lib_trollop.rb, an alternative implementation of an option / cli parser
(Maint) Consistently use the same agent fqdn

Previously, the test would always fail when the rhel6-32-1 box was
reverted to its `git` snapshot, and the test executed. The box, for
better or worse, reports the following:

    [root@rhel6-32-1 ~]# hostname -f
    rhel6-32-1
    [root@rhel6-32-1 ~]# facter fqdn
    rhel6-32-1.puppetlabs.lan

The agent submits its report using the latter, but the test attempts to
retrieve the facts using the former:

    curl -k -H \"Accept: yaml\" https://rhel6-32-1:8140/override/facts/`hostname -f`"

And that always fails:

    Could not find facts rhel6-32-1

This issue does not occur when running the non-Windows acceptance tests,
because those jobs run on centos-55-386-1 and ubuntu-1004-32-1, which
don't have inconsistency in their domain as reported by facter and
`hostname -f`

This commit changes the test to request the facts from the master using
the same fqdn that the agent used in its report.
Merge pull request #581 from joshcooper/maint/2.7.x/fix-fqdn-rendezvous

(Maint) Consistently use the same agent fqdn
Merge pull request #580 from pcarlisle/ticket/2.7.x/13117-semodule-broken

(#13117) fix semodule broken by misuse of readline vs each_line.
(#3022) File type's force attribute's description is incomplete

Puppet always resists destroying directories unless you use force => true. The
previous description of the attribute said something noncommittal about
replacing directories with links; this commit describes its complete behavior.

This commit also improves the description of purge.
Merge remote-tracking branch 'daniel-pittman/refactor/2.7.x/4862-remove-the-event-loop-library' into 2.7.x

* daniel-pittman/refactor/2.7.x/4862-remove-the-event-loop-library:
  (#4862) Finally remove the event-loop library.
  (#4862) define_method is not a public method in Ruby.
  (#4862) `returning` is not a standard Ruby method.
  (#4862) Stop using EventLoop in the Puppet daemon.
Merge pull request #583 from nfagerlund/ticket/2.7.x/3022_force_attribute

Ticket/2.7.x/3022 force attribute
(#7749) Parse command line args and config file before loading app/face

This commit is mostly focused on solving the following chicken-and-egg
problem: the way the code worked before, the command_line class would
try to load an app before doing any parsing of the cli args or the
puppet config file.  However, we want to support being able to load apps
and faces from the libdir... and if your libdir is in a non-standard
location, which you've specified via the command line or config file, then
the command_line class would fail to find any apps that were in your
libdir and exit before it ever even looked at the cli args or the config
file.

To get around this, and to prepare for supporting the ability to run
faces without an application stub, we needed to move the parsing of
the cli args and config file to an earlier point in the lifecycle.

The major changes in this commit are:

* Move the initial parsing of the cli args and the config file out of
application.rb and into command_line.rb so that they happen before
puppet tries to locate apps/faces.

* Remove all of the "should_parse_config" and "should_not_parse_config"
options and tests from the various apps.  These are not relevant any
longer because we always need to parse the config file to make sure
we know where the libdir is before we try to load faces / apps.

* Introduce a new option parser implementation, to supplement and
perhaps eventually replace our use of the Ruby stdlib OptionParser.
The stdlib OptionParser has some very undesirable behaviors that
are not configurable; the new PuppetOptionParser is a wrapper
around an open source parser called "trollop"; it maintains the
same API that OptionParser exposes, but gives us complete control
over what is happening behind the scenes.

Conflicts:

	spec/unit/util/command_line_spec.rb
(#7749) Improvements to handling settings, bootstrapping puppet

Major changes include:

* support multiple config files (/etc/puppet, ~/.puppet).  we no longer
use "run_mode" to determine the location of the config file.
* remove all references to application run_mode/state from defaults
* make the typing of settings a little more strict
* create a new setting type for directories, to make us a little less vulnerable to the terrible matching algorithm in FileSetting
(#7749) get rid of "set_run_mode" method in Application class

The "set_run_mode" method in the Application class made it a little
too easy to do dangerous / scary things to the main application
state during run time.  Get rid of this method and provide slightly
more controlled ways to accomplish the necessary goals.
(#7749) get rid of $puppet_application_name and $puppet_application_mode globals

This state is now handled via instance variables in the Settings class.
(#7749) rename "Settings#setdefaults" to "define_settings"

This is just to clarify the intent of the code, mostly in defaults.rb.
The old signature still exists, but prints a deprecation warning.
(#13296) 'unless' as a parameter inside a resource causes syntax error

Add test to validate that unless gets parsed properly if a parameter
Add case to grammar to PARAMETER for UNLESS => EXPRESSION
Regenerate parser from grammar
(#7749) doc / tests cleanup
Merge pull request #571 from puppetlabs/integration/master/7749-bootstrapping-puppet

(#7749) improve bootstrapping puppet to support pluginsync apps.
Add comment with URL of upstream pull request for trollop

Submitted a patch to the upstream trollop library, in hopes
that these changes will get included and we won't have our
own custom fork of the project.  Added this to the comments
for visibility.
Merge pull request #590 from cprice-puppet/cleanup/master/trollop_pull_request

Add comment with URL of upstream pull request for trollop