(#16376) Fix rails compatibility layer for activerecord < 3.0

Previously an alias was attempted between scope and named_scope to allow older
activerecord versions (< 3.0) to work with the inventory service while also
supporting modern activerecord. The scope alias failed because
Puppet::Rails::InventoryNode inherits from ActiveRecord::Base, which has a
scope method already. So activerecord's scope method is found instead of the
intended alias target. This commit removes the alias and simply switches on
activerecord version to use the correct scope (AR >= 3.0) or named_scope (AR <
3.0) method.
fail better in package repo rake tasks

This commit modifies the top level Rakefile to only
load the packaging repo yaml file if it exists, as
well as provide some error handling for other unwanted
conditions that may arise as a result of trying to
set up the packaging repo.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #1171 from MosesMendoza/maint/2.7.x/cleanup_package_repo_rake_tasks

fail better in package repo rake tasks
Merge pull request #1136 from haus/ticket/2.7.x/16376_update_rails_compatibility_layer

(#16376) Fix rails compatibility layer for activerecord < 3.0
(#16698) Do not set Node cache_terminus for storedconfigs

The hook on the storedconfigs setting would try and setup the terminuses
so that they were properly wired up to the store configs. One part of
this was to set the `cache_terminus` for the `Puppet::Node` to
`:store_configs`. However, up until commit
5a79d9abd96e73ff166527cdee69a30da8ab0f87 this was overridden by the
master application to be `:yaml`. That commit removed this so that an
ENC was able to be authoritative, but once it was removed the store
configs cache terminus was left on and interferred with the ENC.

This commit removes the cache for the `Puppet::Node` since there is no
need for it and all it does is interfere with fetching node data. The
`Puppet::Node::Facts` store configs code will actually create the entry
in the `host` table that is needed.
(#16698) Add acceptance test for using store configs with an enc

This adds a simple test that the ENC is not shadowed by the store
configs. There is no check that the store configs actually can be used.
That is another whole that should be plugged at another time.
Merge branch 'ticket/3.0.x/16698-enc-does-not-work-with-store-configs' of git://github.com/zaphod42/puppet into 3.0.x

* 'ticket/3.0.x/16698-enc-does-not-work-with-store-configs' of git://github.com/zaphod42/puppet:
  (#16698) Add acceptance test for using store configs with an enc
  (#16698) Do not set Node cache_terminus for storedconfigs
(#16769) Fix header too long error with ExportCertData

Without this patch new Puppet agent nodes who do not yet have a signed
certificate will receive this error message when Apache is configured
with the +ExportCertData option.

    Error: Could not request certificate: Error 400 on SERVER: header too long
    Exiting; failed to retrieve certificate and waitforcert is disabled

This is a problem because Puppet doesn't run at all.

The root cause is that we didn't take into account the edge case where a
Puppet agent is operating as an anonymous SSL client without a signed
certificate.  In this situation, the  SSL_CLIENT_CERT environment
variable is set, but is the empty string.

Worse, the OpenSSL error message is mis-leading because the certificate
is not present rather not "too long."

This patch fixes the problem by explicitly checking if the data is empty
or nil.
Merge branch 'fix/3.0.x/16769_export_cert_data_too_long' into 3.0.x

* fix/3.0.x/16769_export_cert_data_too_long:
  (#16769) Fix header too long error with ExportCertData

Paired-with: Henrik Lindberg <henrik.lindberg@cloudsmith.com>
Merge branch '3.0.x'

* 3.0.x:
  (#16769) Fix header too long error with ExportCertData
  (#16698) Add acceptance test for using store configs with an enc
  (#16698) Do not set Node cache_terminus for storedconfigs
(#16922) Quote strings that contain ":"

Part of the performance work on the ZAML code caused a regression on how
to convert values that contain a colon into YAML strings. This becomes a
problem when a string ends in a colon and that line in the YAML output
is followed by another line.

An example of the incorrect output is:

  ---
  a: a:
  b: 1

This patch causes that to be output correctly as:

  ---
  a: "a:"
  b: 1
Merge branch 'ticket/3.0.x/16922-colon-on-fact-names-causes-problem' of git://github.com/zaphod42/puppet into 3.0.x

* 'ticket/3.0.x/16922-colon-on-fact-names-causes-problem' of git://github.com/zaphod42/puppet:
  (#16922) Quote strings that contain ":"
(#16922) Quote strings that contain ":"

Part of the performance work on the ZAML code caused a regression on how
to convert values that contain a colon into YAML strings. This becomes a
problem when a string ends in a colon and that line in the YAML output
is followed by another line.

An example of the incorrect output is:

  ---
  a: a:
  b: 1

This patch causes that to be output correctly as:

  ---
  a: "a:"
  b: 1
Merge branch 'backport-colon' into 2.7.x

* backport-colon:
  (#16922) Quote strings that contain ":"
Merge remote-tracking branch 'upstream/2.7.x' into 3.0.x

* upstream/2.7.x:
  (#16922) Quote strings that contain ":"
  fail better in package repo rake tasks
  (#16376) Fix rails compatibility layer for activerecord < 3.0
Merge remote-tracking branch 'upstream/3.0.x'

* upstream/3.0.x:
  (#16922) Quote strings that contain ":"
  (#16922) Quote strings that contain ":"
  fail better in package repo rake tasks
  (#16376) Fix rails compatibility layer for activerecord < 3.0
Merge remote-tracking branch 'upstream/master'