Maint: Remove unused variable in user spec

If rspec already gives us the described class why not using it.
Maint: Add a real provider class to user spec

Add a real provider class we can use in the tests.
Maint: Use real objects in user spec

Remove all references to the mock resource object
Maint: Remove unused mock objects in user spec

Also remove the modification of the PATH environment variable because we
will always have our :simple provider which does rely on any commands in
/sbin.
(#1076) Show warning if an empty group is specified

If the user passes an empty group to the user type, puppet will execute
an invalid `usermod` command.

e.g. if groups of user 'foo' is currently 'bar' and we do

    user { 'foo':
      groups     => '',
      membership => minimum # this is the default
    }

puppet will build a should value of ',bar' (old group + the new group '') and
will pass '-G ,bar' to the usermod command (which will then fail).

To really specifiy 'no group' the group property does allow an empty
array so we should fail if we find an empty string as a group.
(#13204) Workaround duplicate Augeas save events

Bug #264 in Augeas causes duplicate save events to be returned when editing
under /boot in newfile mode.  Because we loop around these events, diffing and
unlinking the files, this causes an ENOENT error when we process the same event
twice.

This commit checks that the file we intend to operate on exists.
Quote strings containing hex numbers when generating ZAML

When generating ZAML, we prefer to write bare strings when possible. To
that end, we have rules about which sorts of strings are not safe to
write bare. One of those rules is strings containing numbers (for if we
wrote those bare, they would be revived as numbers). However, ZAML
wasn't properly considering hex digits when identifying a string
containing a number, resulting in those strings being written unquoted,
and revived incorrectly as numbers.

That is, YAML.load(ZAML.dump("0xffff")) would return 65535, when it ought
to be "0xffff".
(#12466) unset X-Forwarded-For header

Without this patch the handling of
X-Forwarded-For headers is insecure in a
default apache conf supplied with puppet.
This patch ensures X-Forwarded-For headers
are dropped.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
(#12101) Add shared context for specs to imitate windows or posix

Add "windows" and "posix" shared contexts to rspec. If you give :as_platform
=> :posix or :as_platform => :windows as argument to a describe block, it will
automatically stub the relevant facts and path behavior to imitate windows or
posix.
(#12101) Make Puppet::Util::absolute_path? usable in autoloader

This makes Puppet::Util::absolute_path? check File::ALT_SEPARATOR to determine
path behavior of the local system instead of Puppet.features, which required
having an Autoload instance already. File::ALT_SEPARATOR is only defined on
systems with Windows path behavior, and the Ruby standard library uses this
frequently to distinguish systems.
Removed unused code

There is no way that this code can be used since in tries to require
puppet/network/handler which doesn't exist. So if this code was ever
loaded it would raise an error.
Monkey patch FileUtils.mv in Ruby 1.8.5

The FileUtils.mv method in Ruby 1.8.5 can't mv directories across
devices.  File.rename causes "Invalid cross-device link" errors, which
is rescued, but in Ruby 1.8.5 it tries to recover with a copy and
unlink, but the unlink causes the error "Is a directory".  In newer
Rubies remove_entry is used, so the implementation in this patch is
what's used in Ruby 1.8.7 and Ruby 1.9

This was an issue in installing modules using `puppet module install`
since the module is extracted to a temporary directory and then moved to
the modulepath.
(#13367) Patch SemVer to permit ranges including pre-release components.
Make core changes needed for the puppet module tool

This includes changes to portions of the Puppet code base that have some
use by other parts of Puppet than the module tool, but are necessary for
the module tool work.
(#13397) fix gem provider ensure=>latest bug

As of 2.7.12, if you had "ensure=>latest" for any gem package
resource, puppet would not correctly detect that the gem
was already installed and would attempt to install it on
every run.  (This was because the "latest" method on the
gem provider was always returning an array, when it should
always be returning a single value.)
Add Module Tool

This rather large commit includes all the work needed to get the `puppet
module` face in Puppet with all it's actions.  I tried to break this up
into smaller commits, but it was difficult to do so and keep the
individual commits in a state that had passing specs since many changes
in shared module_tool code affected multiple actions.  This code was
developed in an integration branch over a few montsh and is now being
merged back into Puppet core in the same state that shipped with Puppet
Enterprise 2.5.

The work here was done by Pieter van de Bruggen <pieter@puppetlabs.com>,
Kelsey Hightower <kelsey@puppetlabs.com> and myself.
Merge pull request #613 from puppetlabs/geordi

Add Module Tool
(#3581) Stop forking around: Add fork helper method

Without this patch we are forking all over the place. All this forking
around is problematic when it comes to things like ActiveRecord and
database connections. It turns out that forking has a nasty side effect
of aggressively closing database connections and spewing errors all over
the place.

This patch introduces a new `Puppet::Util#safe_posix_fork` method that
does forking the right way (closing file descriptors, and resetting
stdin, stdout, and stderr). Tagmail, Puppet kick, and
`Puppet::Util#execute_posix` have been updated to make use of this new
functionality.

In the future, `Puppet::Util#safe_posix_fork` should be used in-place of
direct calls to `Kernel#fork`.

This patch includes related spec tests.
(#9167) Do not send email when nothing changes

Without this patch the tagmail report sends an email even when there are
no changes or resources out of sync. This has the undesired effect of
sending emails after every Puppet run.

When there are no changes or out of sync resources, tagmail logs a
notice stating the fact and skips processing logs and sending emails.

This patch includes new spec tests for the changes in behavior.
Removed text/marshal support

Removing text/marshal support in order to close the security
vulnerability described in Bug #13552.