(#14822) Re-evaluate features if they previously were false

Allow features to be re-evaluated each time they are checked, if they
previously evaluated to false.  This allows for providers by features to have
dependencies installed during a run and then for the feature state to change
from false to true.

Caching of feature results that were previously true has been kept.  Caching of
blocks used to evaluate features remains unaffected and are still run only once.
(#14822) Use feature confine for feature tests during run

Fixes two providers to use the "confine :feature" statement, allowing for the
features to be re-evaluated during a run instead of only once.
(#16791) Revert "Merge branch 'perf/2.7.x/backport-activesupport-hook-disabling' of https://github.com/daniel-pittman/puppet into 2.7.x"

This reverts commit 3d747177c3e3f690effe620d2f38c7a7d0f7d2d9, reversing
changes made to e45961f2a4160875ed1069b18734d3a6456af831.

This change to how puppet interacts with ActiveRecord causes problems
for systems that load puppet inside Ruby on Rails. Foreman encountered
this. Rather than introduce this change that can break existing installs
of puppet, this performance is not going to be part of 2.7.
(#16791) Revert "Maint: Fix intermittently failing spec test"

This reverts commit e45961f2a4160875ed1069b18734d3a6456af831.

This commit is being reverted in order to completely and cleanly revert
ba96917.
(#16791) Revert "Merge branch 'feature/2.7.x/json-terminus-backport' of https://github.com/daniel-pittman/puppet into 2.7.x"

This reverts commit ba969173ffad096401bc5d0df44b17324318ca03, reversing
changes made to 5e3fbcae67cfe4e3eb0564735742354bf85d79e7.

This change had introduced a new terminus for the catalog indirection
that wrote json files instead of yaml. Unfortunately the changes didn't
include actually being able to configure puppet to use this. This left
the decision about whether to backport another functionality change, or
to undo this change.

Since 2.7 is supposed to be a stable branch and should only be receiving
bug fixes, this change does not really belong in the 2.7 series. All of
the other backported performance fixes are small tweaks to existing
behavior, whereas this one provides a new set of functionality.
Therefore this change will not be made in the 2.7 series.
Eliminate `symbolize` everywhere, and remove it.

The whole `symbolize` API was confusing and complex: because it didn't do any
type enforcement, just passed through arbitrary data, we had very unclear API
in a whole pile of places.

This replaces that method entirely with a more rigid definition: we intern in
a bunch of places, add the occasional clear failure mode, and then delete the
original definition.

This eliminates one point of complexity from the codebase.

(These other uses have no notable performance penalty, just code complexity
 and clarity issues.)

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Conflicts:

	lib/puppet/parser/functions.rb
	lib/puppet/provider.rb
	lib/puppet/provider/nameservice/directoryservice.rb
(#16791) Re-instate deprecated symbolize and symbolizehash!

The cherry-pick of commit a09df46f58187ad9ff0f599de47cd8c1e0a417eb to
remove the use of symbolize throughout the code base also removed the
symbolize method, as well as the symbolizehash! method. The cherry-pick
was needed so that the methods could be deprecated without puppet
issuing warnings from using them.

This commit puts the two methods back and also places a deprecation
warning in them.
Merge branch 'ticket/2.7.x/16791-cleanup-performance-backports' into 2.7.x

* ticket/2.7.x/16791-cleanup-performance-backports:
  (#16791) Re-instate deprecated symbolize and symbolizehash!
  Eliminate `symbolize` everywhere, and remove it.
  (#16791) Revert "Merge branch 'feature/2.7.x/json-terminus-backport' of https://github.com/daniel-pittman/puppet into 2.7.x"
  (#16791) Revert "Maint: Fix intermittently failing spec test"
  (#16791) Revert "Merge branch 'perf/2.7.x/backport-activesupport-hook-disabling' of https://github.com/daniel-pittman/puppet into 2.7.x"
(#16791) Remove tests for unused behavior

The symbolize change caused two tests for the behavior around invalid
inputs to start failing. Looking at the tests, they are testing code
that would never reasonably be called with these kinds of values since
there are only a few places that call the methods being tested and those
use hard coded values. The fix here is to remove the tests that were
failing.
Merge pull request #833 from domcleal/tickets/2.7.x/14822-feature-runtime

(#14822) Ensure providers can run if features are delivered during a run
(#10146) `-` in variable names should be deprecated!

In commit b26699a2 I fixed an accidentally introduced change to the lexer,
allowing `-` to be part of a variable name.  That had lasted for a while and
was surprisingly popular.  It was also hugely ambiguous around `-` as minus,
and led to all sorts of failures - unexpected interpolations to nothing -
because of that.

A much better strategy would have been to deprecate the feature, issue proper
warnings, and include an option to allow users to toggle the behaviour.

Initially defaulting that to "permit", and eventually toggling over to "deny",
would have made the whole experience much smoother - even if this was totally
documented as not working, and was a clear bug that it changed.

So, thanks to prompting from Benjamin Irizarry, we do just that: introduce the
configuration option, default it to "deny" to match current behaviour, but
allow users the choice to change this back.

Please be aware that allowing variables with `-` might break all sorts of
things around, for example, Forge modules though.  Most people write code to
the documented standard, and their code might well totally fail to work with
this changed away from the default!

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Edit description of hyphenated variables compatibility setting

This commit shortens and tightens the description of this setting.
(#17260) Warn when variables contain hyphens

Previously the deprecation warnings for hyphens in variables
incorrectly warned even when there were no hyphens in the variable.
There was also no warning about hypens in variable interpolations when
the bare-word form of interpolation was used, e.g. "${foo-bar}".

This commit causes those two cases to warn correctly and also cleans up
the tests to be more directed to just the lexing of specific tokens.
This also removes some duplication that crept in around checking and
issuing the warning.

Paired-with: henrik.lindberg@cloudsmith.com
Merge pull request #1243 from zaphod42/feature/2.7.x/17260-deprecation-warning-for-hyphens-in-variables

(#17260) Issue warning for hypens in variables
Remove the asc file from the source of spec file

The asc file was never used during builds. This commit removes it as a
requirement to build puppet.  This will help with nightly builds and
allow easier community adoption of our build system (along with
automation).

This commit has already been made in the 3 series of puppet.

Signed-off-by: Michael Stahnke <stahnma@puppetlabs.com>
Merge pull request #1244 from stahnma/fix_build_defaults_for_community

Remove the asc file from the source of spec file
Update Rakefile to make rspec optional

Currently rspec is a hard dependency to using the Rakefile for puppet. This
means that users on platforms without native rspec packages can't use the
Rakefile to do other things, like build packages. This commit moves the require
on rspec and rspec/core/rake_task into a begin/rescue block and wraps the call
to Rspec::Core::RakeTask in an `if defined?` conditional so it is only invoked
if Rspec is loaded and available.
Merge pull request #1245 from haus/make_rspec_optional_in_rakefile

Update Rakefile to make rspec optional
(#17260) Include link to information about deprecation

Previously the deprecation warning did link the user to any additional
information about the warning. This adds a link that can be followed to
get a better explanation of the issue and how to resolve it.
Merge commit 'd892859' into 3.0.x

* commit 'd892859':
  (#16791) Remove tests for unused behavior
  (#16791) Re-instate deprecated symbolize and symbolizehash!
  Eliminate `symbolize` everywhere, and remove it.
  (#16791) Revert "Merge branch 'feature/2.7.x/json-terminus-backport' of https://github.com/daniel-pittman/puppet into 2.7.x"
  (#16791) Revert "Maint: Fix intermittently failing spec test"
  (#16791) Revert "Merge branch 'perf/2.7.x/backport-activesupport-hook-disabling' of https://github.com/daniel-pittman/puppet into 2.7.x"