(#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.
Fixed #14975 - Fixed incorrect help text in puppet doc application
(#14441) Require instrumentation indirections

Previously, the instrumentation faces were not requiring their
corresponding indirection, so the indirections were not getting
registered,
e.g. Puppet::Indirector::Indirection.instance(:instrumentation_data)
was nil.  This was causing `spec/integration/documentation_spec.rb` to
fail -- it was iterating across each face and trying to generate help,
but that failed because the indirection wasn't registered.  This issue
didn't show up earlier, because due to a separate issue, the tests
were not being executed.

This issue only occurs when using the instrumentation related classes
programmatically, but not when running the applications, e.g. `puppet
instrumentation_data` because the latter calls
`Puppet::Util::Instrumentation.init` early on in the application
lifecycle, and that requires all of the instrumentation code.

This commit changes each instrumentation-related face to require its
instrumentation indirection, e.g. Puppet::Face[:instrumentation_data]
requires `puppet/util/instrumentation/data`.

This commit doesn't address the overall issue with #14441 in that
Puppet::Util::Instrumentation.init` has to be invoked before it can be
used, so don't close the bug when this is merged.
Maint: Actually execute the tests on non-windows platforms

Previously, the tests were using conditional pending statements to
mark tests that don't pass on Windows:

  describe "group" do
    pending("porting to Windows", :if => ...) do
      it "should ..." do
        ...
      end
      it "should ..." do
        ...
      end
    end
  end

But this is not a valid use of conditional pending statements, and it
causes the examples within the pending block to be silently skipped.
Instead, the conditional pending statement needs to be within the
example:

  it "should ..." do
    pending("porting to Windows", :if => ...) do
      ...
    end
  end

In our case, we want to mark a set of examples as pending, so we use
an rspec exclude filter instead:

  describe "something", :unless => Puppet.features.microsoft_windows? do

Some tests now pass on Windows, using :file instead of :mount and the
instrumentation documentation, so I enabled them.
(#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.
tidy.rb: Added info about the default value of 'type' to the doc.
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 #859 from joshcooper/maint/master/conditional-pending

Re-enable tests that were being skipped on non-Windows platforms
Merge pull request #852 from jamtur01/ticket/master/14975

Fixed #14975 - Fixed incorrect help text in puppet doc application
Merge pull request #883 from jakubholynet/master

tidy.rb: Added info about the default value of 'type' to the doc.
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