(#10354) added delete command to fix missing userdel flag in useradd provider
Fixes for #10915 and #11200 - user provider for AIX

The user provider on AIX fails to set the password for local users
using chpasswd.

This commit includes the code in ticket #11200 suggested by Josh
Cooper. It works in my environment (AIX 5.3 + 6.1).

chpasswd can also return 1 even on success; it's not clear if this is
by design, as the manpage doesn't mention it. The lack of output from
chpasswd indicates success; if there's a problem it dumps output to
stderr/stdout.
(#13880) Add openrc service provider for Gentoo and Funtoo

Gentoo uses openrc (at least since baselayout-2) to
start/stop/enable/disable services. This can be done with the following
commands

    /bin/rc-status   - show runlevels
    /sbin/rc-service - start/stop a service
    /sbin/rc-update  - enable/disable a service

The openrc provider was written as a replacement for the current gentoo
provider. The gentoo provider does just use the openrc commands to
enable/disable a service but it still calls the initscripts directly to
start a stop service. The gentoo provider does also have problems with
long service names (#5197).

The reason why this is a seperate provider: #5197 states that the
rc-service command was probably introduced when gentoo upgraded from
baselayout-1 to baselayout-2 (I wasn't really able to verify this)
so the openrc provider will not work on all gentoo systems.

It is also notable that the new openrc provider does not put any confines
on operatingsystem so the service provider may also be used on other
systems that use openrc (like the Gentoo fork "Funtoo")
(#13880) Add openrc spec - service with extreme long name

The old gentoo provider has some problems handling services with really
long names (#5197).

Add a tests to check the correct behaviour of the openrc provider. The
fake rc-status output was captured after creating a fake initscript in
/etc/init.d with a really long name
(#14599) Handle ENOTDIR in file type

If a file resource is used with a path where a component of path is not
a directory, the stat systemcall can raise the error Errno::ENOTDIR
which was not handled by the file type.

This can lead to the following error (if e.g /tmp/xx is a normal file)

    err: /Stage[main]//File[/tmp/xx/yy/zz/1]: Could not evaluate: Not a
    directory - /tmp/xx/yy/zz/1

Catch the error and return nil in the stat method like we do for absent
files or file where we do not have the permission to stat.

Puppet will still raise errors when trying to create such a file of
course like

    err: /Stage[main]//File[/etc/fstab/foo]/ensure: change from absent to
    file failed: Could not set 'file on ensure: Not a directory -
    /etc/fstab/foo at line

But something like

    puppet apply -ve 'file { "/etc/fstab/foo": ensure => absent}'

will now work without errors because `/etc/fstab/foo` is indeed absent.
(#14860) Fix puppet cert exit status on failures

Without this patch applied the following command errors out but does not
correctly set the exit status:

    puppet cert generate foo.bar.com --dns_alt_names foo,foo.bar.com

The error returned is:

    err: Could not call generate: CSR 'pe-internal-broker-test'
      contains subject alternative names (DNS:pe-centos6, \
      DNS:pe-centos6.puppetlabs.vm, DNS:pe-internal-broker-test, \
      DNS:stomp), which are disallowed. Use `puppet cert \
      --allow-dns-alt-names sign pe-internal-broker-test` to sign this \
      request.

However, the exit status is 0.

This is a problem because we need to easily detect if certificate
generation from the command line failed or succeeded.  The most natural
and expected way to check this is by looking at the exit status.

The root cause of the problem is that
Puppet::SSL::CertificateAuthority::InterFace#apply incorrectly catches
and masks the exception raised by the generate method because it simply
logs an error with Puppet.err and continues along happily.

This patch fixes the problem by re-raising the error produced by
generate, allowing the application controller to catch the error
appropriately and exit with the non-zero exit status.
(#14531) Change default ensure value from symlink to link

If ensure on a file resource is omitted, puppet will set the should value
to :symlink in the initialize method of the file type but the ensure property
does not use :symlink but :link to identify a link.

As a result, puppet will always treat a resource with a specific target
property but no ensure property as out of sync:

    file { '/tmp/a':
      target => '/tmp/b',
    }

When puppet now calls sync on the ensure property, the fileresource
(`/tmp/a`) is removed first (method `remove_existing`) but we do not
execute the block passed to `newvalue(:link)` to recreate it. Because
there is no `newvalue(:symlink)` block, we instead run the block in
`newvalue(/./)` which is just a dummy and does nothing at all. As a
result puppet will *always* say it created something while in fact
making sure that the resource is *removed*.

Change the default ensure value from :symlink to :link if target is
set.
(#14600) Fix cleanup of tempfiles in file_spec

The file integration test uses temporary files that will be removed
after each test. A few tests however use the backup functionality of the
file resource type and these backups were not removed.

Create a temporary directory where the dummyfile is placed. This way the
spec helper will remove the whole directory after each test including
every backup of the dummyfile that might have been created during the
testrun.
Merge pull request #388 from codec/ticket/2.7.x/10354-missing-userdel-flag

#10354 Missing userdel flag in provider/useradd.rb when managehome is set to true
Merge pull request #869 from stschulte/ticket/2.7.x/14600

#14600 Cleanup temporary files in file integration spec
Determine packaging version with git describe

This commit modifies the rakefile to use git describe
to determine the package version instead of the hard-coded
version in lib/puppet.rb. This takes a couple steps
out of packaging RCs. The specific string manipulation
is borrowed from puppetdb packaging.

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

Maint/2.7.x/use git describe in packaging
Merge pull request #839 from jeffmccune/ticket/2.7.x/14860_puppet_cert_generate_subcommand_does_not_exit_with_non-zero_status_when_certificate_is_not_created

(#14860) Fix puppet cert exit status on failures
Merge pull request #805 from stschulte/ticket/2.7.x/14599

#14599 Handle ENOTDIR in file resource
Merge pull request #864 from stschulte/ticket/2.7.x/14531

#14531 Fix default ensure value for symlinks
Merge pull request #585 from andytinycat/2.7.x

2.7.x - fix for password setting on AIX user provider
Merge pull request #654 from stschulte/feature/2.7.x/13880

Add openrc service provider for Gentoo and Funtoo
(Maint) Don't assume paths are absolute

Previously, the spec test failed on Windows, because the test assumed that
paths such as '/sbin/rc-service' are absolute on every platform. Since
they are not absolute on Windows, the test would fail.

This commit changes the test to not rely on the internals of the
`Puppet::Util.which` command that is included in every provider.
Merge branch 'maint/2.7.x/openrc-spec' of github.com:joshcooper/puppet into 2.7.x

* 'maint/2.7.x/openrc-spec' of github.com:joshcooper/puppet:
  (Maint) Don't assume paths are absolute
Merge branch '2.7.x' into 3.x

* 2.7.x:
  (Maint) Don't assume paths are absolute
  Determine packaging version with git describe
  (#14600) Fix cleanup of tempfiles in file_spec
  (#14531) Change default ensure value from symlink to link
  (#14860) Fix puppet cert exit status on failures
  (#14599) Handle ENOTDIR in file type
  (#13880) Add openrc spec - service with extreme long name
  (#13880) Add openrc service provider for Gentoo and Funtoo
  Fixes for #10915 and #11200 - user provider for AIX
  (#10354) added delete command to fix missing userdel flag in useradd provider

Conflicts:
	lib/puppet/ssl/certificate_authority/interface.rb
	spec/integration/type/file_spec.rb
	spec/unit/ssl/certificate_authority/interface_spec.rb