(PUP-1463) Enable puppet.service during upgrade if puppetagent.service was previously enabled
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (PUP-1411) Increase CLIENT_HELLO timeout
  (PUP-1411) Initialize OpenSSL before starting TCP connection
Merge pull request #2298 from mckern/add-el7-to-stable

Apply the RHEL7 work and merge it into stable
Merge branch 'stable'

Conflicts:
	ext/build_defaults.yaml
(PUP-1118) Fix rdoc1 specs to match changes to rdoc puppet_parser_core

PuppetParserCore was updated to pass environment, known_resource_types;
this just catches up the spec, which runs only on 1.8.7, to match the
changes.
Merge pull request #2269 from skottler/PUP-1463

(PUP-1463) Enable puppet.service during upgrade if puppetagent.service was previously enabled
(Maint) Remove dead port code

The port code has been commented out and unmaintained since 5d2f95 (~7
years ago).
Merge pull request #2308 from zaphod42/maint/master/remove-dead-port-code

(Maint) Remove dead port code
(Maint) Fix load order dependency

Running bundle exec rspec spec/unit/module_tool/install_directory_spec.rb
would fail because the Puppet::ModuleTool::InstallDirectory classes
referenced the Errors module without ensuring it was required.

This commit ensures that all of the module_tool leaf code requires its
parent first, and any code that they directly reference, e.g. open-uri
Merge pull request #2306 from zaphod42/feature/master/pup-1118-implement-environment-directory

(PUP-1118) Use directory environments as environments
(maint) Fixing acceptance test failure caused by GH-2293.

We have our own version of "fail" that takes different parameters than Kernel::fail.  This lead to accidentally passing in a backtrace array (what Kernel#fail expects) instead of the original exception object (what Puppet::Util::Errors#fail expects).  This causes a failure when attempting to format the nested exception because it is not the correct type.
(PUP-576) Handle Ruby 2.0 OpenSSL lib error message

The error message returned by Ruby's OpenSSL library when the host name
does not match the server certificate changes between 1.8, 1.9 and 2.x.
We handle this message and re-wrap it in a more informative form, but
were failing to catch the 2.x variation.

1.8: 'hostname was not match with the server certificate'
1.9: "hostname does not match the server certificate"
2.x: "hostname \"#{hostname}\" does not match the server certificate"

(2.0 and 2.1 as of the time of this commit)

This change just alters the regex to catch all three variants.
(PUP-1529) Make squelch of parse error specific to resource_type command

Without this fix, all indirect loading of .pp logic will silently fail.
With this fix, only queries via the resource_type command have
parse errors squelched in order to allow search to continue past a
syntax error.
Merge branch 'stable'

Conflicts:
	lib/puppet/indirector/resource_type/parser.rb
(maint) Fix error message in reduce function

If you had 3 parameters this error message would print the type of the
wrong parameter.
(PUP-1529) Make squelch of parse error use context instead of global

This fixes up the earlier fix for 3.4.x where a global variable
was used to control if parse errors should be raised or not.

Now the context system is used instead of a global variable. (It is
still a boolean value since there is no other immediate use for a
strategy that either raises the error or logs the problem).
Merge pull request #2312 from dalen/future_parser_fix

Fix error message in reduce function
(PUP-576,PUP-1064) Update to activerecord 3.2.x to work around a Ruby 2.x issue

tests/store_configs/enc_provides_node_when_storeconfigs_enabled.rb fails
running under Ruby 2.0 because of a bug between activerecord 3.0 and
Ruby 2.0.  This fails with:

  'undefined method `insert_record' for <Array:0x00000003027be8>'

when Puppet::Rails::Host attempts to save with merged facts.  The root
cause is tangled up in ActiveRecord's association proxies.

ActiveRecord 3.2 has patches which allow it to work under Ruby 2.0

However making this change unearthed another Rails issue which Andrew
Parker recalled was in fact PUP-1064.  This issue tracks a
general failure in Puppet on any Ruby version working with ActiveRecord
> 3.0.10.  Fortunately there was a patch attached to PUP-1064 which
guards lookup of the activerecord id property on the
puppet/rails/resource.rb activerecord object, and this does appear to
fix the issue.
(maint) Add optional_parameter_count method to Closure

Add a method to return number of optional parameters on
Puppet::Pops::Evaluator::Closure just like Puppet::Parser::AST::Lambda
has.
(PUP-1118) Convert environment for nodes on load

The environment for a Puppet::Node instance is turned into simply the
name of the environment when the Puppet::Node is serialized. Since we
then load the Puppet::Node back in using YAML, and YAML uses the magic
of type annotations to re-create the Puppet::Node instance, the
environment that ends up being set on the Puppet::Node instance isn't
an instance of Puppet::Node::Environment, but is a String.

Since the Puppet::Node doesn't get a callback during deserialization, we
added a fixup method to the Puppet::Indirector::YAML implementation so
that the node object can be fixed up before being handed out to the big,
bad world.

The other choice was to use safe_yaml to load the file and then do the
conversion, but safe_yaml is significantly slower than just plain yaml
and we decided to avoid the performance hit.