(maint) Guard preserve_configuration in acceptance

It is only useful to attempt to generate a local preserved_config.yml if
you are manually testing and may need to re-run.  Automated tools such
as Jenkins have tripped over this step if the logs or layout are
different, and there is no reason to abort a test run for this step.

This commit changes the behavior of the acceptance harness so that it
only preserves the configuration if you are running the manual
'test_and_preserve_hosts' task, or if you have specified you want this
behavior in your local_options.rb.  It is also a little more resilient
for failures when preserving the configuration.
(doc) Remove outdated notice concerning rdoc and ruby > 1.8.7

This note is deprecated by the following pull requests:

https://github.com/puppetlabs/puppet/pull/2009
https://github.com/puppetlabs/puppet/pull/2187

Relevant redmine ticket:

https://projects.puppetlabs.com/issues/22180
(PUP-2946) Ensure #compare_stream uses binary strings

In Ruby commit 2142287c `FileUtils.compare_stream` was optimized to
produce fewer objects while comparing streams by predeclaring a pair of
strings and reusing them for each iteration of the comparison. However,
this change exposes some inconsistency in how ruby handles IO#read vs
StringIO#read.  When IO#read is passed a length and string, it will copy
the read data into the string, but will convert the encoding from the
expected ASCII-8BIT into the encoding of the string regardless of if the
file was opened as a binary file. However, when StringIO#read is passed
a length and string it will convert the passed string to the expected
ASCII-8BIT. Because of this it's impossible to use `FileUtils.compare_stream`
to compare a binary file and StringIO instance.

To resolve this issue, this commit adds a custom compare_stream method
which sets the encoding of the strings to always be ASCII-8BIT on Ruby
1.9+.
(PUP-2946) Don't use private FileUtils methods

Previously the compare_stream method was using private methods in
FileUtils, which could be subject to change at any time (as private
methods are wont to do). This commit pulls in the implementations of
those methods to isolate ourselves from those potential changes.
Merge pull request #2947 from adrienthebo/issue/master/pup-2946-filebucket-encodings

Issue/master/pup 2946 filebucket encodings
Merge pull request #2948 from jpartlow/maint/master/only-preserve-config-for-local-acceptance-runs

(maint) Guard preserve_configuration in acceptance
Merge pull request #2949 from roidelapluie/Remove_Puppet_Doc_Oudated_Documentation

(doc) Remove outdated notice concerning rdoc and ruby > 1.8.7
(maint) Refactor HTTPS verification tests into a shared examples

This commit refactors the spec tests that ensure puppet displays
meaningful error messages when SSL verification fails, e.g. when the
server certificate doesn't match the hostname we connected to.
(PUP-744) Expand scope of OpenSSL rescue block

The persistent http connection work introduced a regression,
preventing the agent from displaying useful error messages when SSL
verification fails, e.g. the server's SSL certificate doesn't match
the hostname the agent tried to connect to. The connection_spec test
didn't catch the issue, because those tests execute with the
non-caching pool, which always uses non-persistent connections.

The root cause is because the Connection class assumed http
connections are started by ruby in the `Net::HTTP#request`
method, so the OpenSSL rescue block wrapped that call.

However, in order to use persistent http connection, the caller needs
to explicitly start the connection prior to calling Net::HTTP#request,
which happens in the outer `Connection#with_connection` method.

This commit expands the scope of the rescue block. This way we receive
meaningful error messages if the connection is started explicitly for
persistent connections, or on-demand for non-persistent connections. It
also executes the ssl verification tests using persistent connections.

Also note that `with_connection` is private, so the fact that
`Pool#with_connection` or `Net::HTTP#request` can start the connection
is not visible to users of the Connection class.
Merge pull request #2954 from joshcooper/ticket/master/PUP-744-rescue-openssl

(PUP-744) Expand scope of OpenSSL rescue block
(PUP-2879) Add cryptdisks-udev to the services blacklist

Also this patch splits out the long line in upstart_spec.rb to be
one line per service, so more diff-friendly.
Merge branch 'master' into puppet-4
Merge pull request #2956 from kylog/issue/pup-2879/exclude-cryptdisks-udev

(PUP-2879) Add cryptdisks-udev to the services blacklist
Merge branch 'master' into puppet-4
(PUP-3036) Rubocop Style/AndOr autocorrect pass

This commit replaces `and` and `or` keywords in favor of `&&` and `||` where it
can be done automatically (In places where the semantic meaning of the
expression does not change on replacing the `and` keyword with the operator `||`).

Since we are using `rubocop -a` to make the changes, we are assured of the
correctness of translation. These changes have also been individually verified.

We have been able to get rubocop to make further changes than previously by
identifying equivalent patterns identified as different in parsing
(See rubocop issue #1255)
(PUP-3036) Rubocop Style/Not automatic pass

This commit replaces `not` in favor of `!` where
can be done automatically (In places where the semantic meaning of the
expression does not change on replacing the `not` keyword with the operator `!`).

Since we are using `rubocop -a` to make the changes, we are assured of the
correctness of translation. These changes have also been individually verified.

This change is especially useful because after replacing such instances, the
AndOr cop can autocorrect even more instances of violations

This also enables the Style/Not cop
(PUP-3036) Rubocop Style/Not use consistant spacing

This commit ensures that no space is used between the application of
the operator `!` and its operand. That is, it replaces the instances of
`! mymethod` with `!mymethod`

It also enables the Style/SpaceAfterNot cop
(PUP-3036) Rubocop Style/AndOr automatic pass (2)

This commit replaces `and` and `or` keywords in favor of `&&` and `||` where it
can be done automatically (In places where the semantic meaning of the
expression does not change on replacing the `and` keyword with the operator `||`).

Since we are using `rubocop -a` to make the changes, we are assured of the
correctness of translation. These changes have also been individually verified.

This commit takes advantage of the previous changes replacing `not` keyword to
autocorrect even more instances of violations.
(PUP-3036) Rubocop Style/AndOr parenthesis automatic pass

This commit replaces `AndOr` in favor of `and` and `or` where
can be done automatically (In places where the semantic meaning of the
expression does not change on replacing the `and` keyword with the operator `or`).

Since we are using `rubocop -a` to make the changes, we are assured of the
correctness of translation. These changes have also been individually verified.

The difference in this commit is that, we specifically search for instances
where the semantics of `and` or `or` is unchanged from `&&` and `||` when
parenthesis are introduced for method calls. That is, we look for instances
of the form `mymethod a,b or mymethod c` and convert them to
`mymethod( a,b ) or mymethod( c)` before applying the transformation.