Merge pull request #570 from francois/master

Document missing --noop option for puppet apply
(Maint) Don't change permissions on /etc/hosts

Previously, the acceptance test was backing up /etc/hosts, modifying it,
verifying that `puppet resource host` returned all of the host records,
and then moving the backup over /etc/hosts. In doing so, the permissions
on /etc/hosts were overwritten.

Since puppet runs as root on agent nodes, the test was setting the mode
of /etc/hosts to 0600 (based on root's umask).

However, when the node is also a master, the puppet master cannot read
the file, since it runs as `puppet`. This causes problems for any later
test that uses `with_master_running_on`, e.g.
ticket_7117_broke_env_criteria_authconf.rb:

   Could not resolve 192.168.100.114: Permission denied - /etc/hosts

This commit changes the test so that the existing /etc/hosts file is
truncated and the old contents restored, thereby preserving its old
mode.

Ideally, it would be nice to not have to overwrite /etc/hosts at all,
e.g. puppet resource host --param target=/my/tmp/file, but this only
works for a single host resource, not when querying all of them.
Merge pull request #577 from joshcooper/maint/2.7.x/fix-etc-hosts-test

Don't change /etc/hosts permissions in acceptance tests.
Merge pull request #483 from daniel-pittman/maint/master/facter-1.5.7-compatibility-in-test

Facter 1.5.7 compatibility in the test condition.
Merge branch '2.7.x'

* 2.7.x:
  (Maint) Don't change permissions on /etc/hosts
  Update CHANGELOG for 2.7.12
  Update packaging spec files for 2.7.12
(#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.