(PUP-2508) Ensure env & trn-uuid are sent when configurer failures occur

Any failure in the configurer #run code might cause the ensure block to
evaluate early, and a report might be sent missing the details of what
the environment and transaction_uuid should be.

This patch moves where the report fields 'environment' and
'transaction_uuid' are set in the configurer code to ensure they are
populated early.

It also ensures the report environment is modified if the catalog or
server specifies it is different to the launched environment. This is
because we change this mid-flight, so our code simplies updates the
report environment when this happens.

Signed-off-by: Ken Barber <ken@bob.sh>
(PUP-2182) Add virtual_packages feature to package type.

In 3.5.x, the yum package provider changed to accept virtual package
names (packages that provide other package names).

That change in behavior caused some undesirable side-effects. As we did
not give users fair warning that this behavior was changing, we have
decided to change the yum provider back to only accepting "real" package
names by default.

To keep the support for virtual package names, a "virtual_packages"
feature has been implemented on the package type and supported on the
yum package provider.  The feature adds the "allow_virtual" parameter
that controls whether or not virtual package names will be allowed for
install/uninstall.

For now, the default value for this parameter will be false to restore
the previous behavior.  However, a deprecation warning will be issued to
let users know that the default will eventually be changed to true.
Users can prevent the deprecation warning by explicitly setting the
parameter to either true or false.
(PUP-2568) Downcase class name before validating

Previously the check for a valid name was done against the raw input,
however it later downcased the name and used that form. This order
caused Class['A'] to be an error, which isn't desired (at least not
until PUP-1810 is taken care of). By just changing the order of
operations capital letters are once again allowed.
Merge pull request #2626 from kbarber/ticket/stable/pup-2508-no-environment-trn-uuid-compilation-failure

(PUP-2508) Ensure env & trn-uuid are sent when configurer failures occur
(maint) Remove dead code in configurer
(PUP-2522) Include transaction_uuid in node requests

This makes the transaction_uuid available for use by a node terminus, to make
it easier to track the full catalog lifecycle when using an ENC.
Merge pull request #2654 from peterhuene/pup/2182

(PUP-2182) Add virtual_packages feature to package type.
(PUP-2505) Implement DELETE verb for HTTP routing

Duplicates:
   PUP-2483 Deleting a certificate does not work with the API
   PUP-2516 Delete a clients certificate with HTTP API no longer working

HTTP API requests using the DELETE method are failing with "Server Error:
undefined method `each' for nil:NilClass"...

e.g.
 curl -k -X DELETE https://${PMASTER}:8140/production/certificate_status/$AGENT

Traced problem back to missing specification for :DELETE in @method_handlers
(PUP-2505) Add method to specify delete handlers

Amending pull request per review comment.  Adding handler for delete
method.
(PUP-2505) Add test for delete handling
(PUP-2505) Reject requests with unknown HTTP verbs

When we forgot to handle DELETE the error showed up as a 500 because the
code tried to call a method on nil. The correct response is a 405, since
the server does not handle that method. Now that GET, POST, PUT, HEAD,
and DELETE are all covered, it should be safe to respond with 405 in all
other cases.
(PUP-2582) Update apache vhost SSL settings

Previously the apache vhost defined an SSLCipherSuite which included
several weak ciphers. This commit disables the following algorithms:
aNULL, eNULL, DES, 3DES, IDEA, SEED, DSS, PSK, RC4, MD5

Second, previously LOW, SSLv2, and EXP were removed, but not
killed from the list, which meant that they could be added again in
subsequent declarations.

Third, ALL:!ADH meant that AECDH was enabled. This commit uses !aNULL
to disable all anonymous authentication algorithms. It also explicitly
specifies !eNULL (anonymous encryption algorithms).

Fourth, we were only enabling SSLv3 and TLSv1, but not TLSv1.1 or
TLSv1.2. TLSv1.2 protects against attacks known to work against SSLv3
and TLSv1.0.

Finally, SSLHonorCipherOrder is set to on, because certain clients do
not send ciphers in the correct preferred order, and this setting will
help mitigate that problem.

Thanks to Aaron Zauner <azet@azet.org> for bringing this to our attention.
Merge branch 'pr/2657' into stable

* pr/2657:
  (PUP-2582) Update apache vhost SSL settings
(PUP-2581) Make illegal names interchangeable to legal variable work

In interpolation when using expression mode ${} and having an illegal
name (e.g. _x) that resulted in a syntax error as the _x got translated
to a STRING token (a bare word not being a name). The interpolation
logic could then not transform it into a (valid) variable expression
(i.e. $_x).

The change is to let the lexer emit a WORD token for the illegal NAME.
The interpolation then changes that to a VARIBLE if it is the only
expression. If the WORD token escapes into the grammar, it is equivalent
to having used a quoted string in the source text.

Note that WORD only accepts unqualified input, anything with a : that is
not a valid NAME is still flagged as an error. Thus _x::y, x::_y are
both illegal NAME.
Merge remote-tracking branch 'zaphod42/issue/stable/pup-2505-delete-not-respected' into stable

* zaphod42/issue/stable/pup-2505-delete-not-respected:
  (PUP-2505) Reject requests with unknown HTTP verbs
  (PUP-2505) Add test for delete handling
  (PUP-2505) Add method to specify delete handlers
  (PUP-2505) Implement DELETE verb for HTTP routing
(maint) Reorder code to increase clarity

There were a lot of unless cases that made it hard for me to track down
the path of what was actually accepted. This inverts the branches so
that the if statements lay out what is required for the good case and
the else clauses express the various failures.

In addition there were a few error scenarios where reordering was
possible and reduced the amount of work that needed to be done before
the error was detected.
(PUP-2568) Remove unnecessary calls

There are several calls that can be removed from various paths. Downcase
isn't needed for the PResourceType's type_name, since that is already
downcased (removes a string copy). The other change is that the NAME
pattern can handle leading :: and so that only needs to be stripped off
if it is a valid name (removes a string copy).
Merge branch 'pr/2656' into stable

* pr/2656:
  (PUP-2568) Remove unnecessary calls
  (maint) Reorder code to increase clarity
  (PUP-2568) Downcase class name before validating

Closes GH-2656
Merge pull request #2661 from hlindberg/pup-2581_interpolating-expression-of-bad-name

(PUP-2581) Make illegal names interchangeable to legal variable in interpolation
(PUP-2610) Maintain context during application exit

Because of the way rack servers get configured by puppet, the
application system needs to maintain any context information that is
setup while starting even after the application has exited. This is
because the rack app is created by calling the "master" application and
using the return value (which threads all the way back through the
application and command line layers) as the rack app. When the contexts
were removed on the way out of the application they also removed the
setup for how environments were loaded.

This also required that there be a way of undoing a series of context
pushes without knowing how many had been done. For this there is now a
mark and rollback capability in the Puppet::Context system. This is used
in the tests to always return to the context that was present at the
start of every test.