(#7841) Always read SELinux module header as little endian

These are always little endian, but are currently being read as native
byte order, which obviously causes failures.
Fix service enable specs on platforms without enable

These specs use the default service provider, but in the case where that
provider doesn't support the enable property, they were failing when
testing various values for that property. Many of these went unnoticed
because they weren't actually making any assertions, but rather checking
that nothing failed, so now they do assert.
Use the right provider instance in launchd provider specs

These tests were creating a resource and a launchd provider instance
from that resource, when the resource already has a (default) provider instance.
In most cases this was working fine, because the resource's provider
instance wasn't often being referred to. However, a couple of tests were
trying to set the enable property of the resource, which fails on systems without an
enableable provider. Now, we explicitly set the resource's provider to
launchd, as use its provider instance for all of our tests.
Fix posix exec provider spec on systems with /bin/cd

This test was setting path to /bin with the assumption that it didn't
contain cd, and therefore the only cd would be a shell built-in. On
system which *do* contain /bin/cd, this was failing. Now we just use a
bogus path so this will work everywhere.
Skip test that runs git if we can't run git

This test was assuming, incorrectly, that it will always be run from
inside a git repo with git installed. Now we properly handle the case
where it's not, and skip the test.
(maint) RPM package provider broken on AIX.

Prior to this commit, the RPM package provider would barf when
attempting to run `self.instances` on AIX. The culprit is the archaic
version of RPM (3.0.5) on AIX. The RPM provider assumed that the
`--nodigest` option (introduced in 4.0.2, circa 2001) was available.
This commit removes the `--nodigest` option for RPM versions older than
4.0.2.
Explicitly fail on downgrades in the AIX package provider

Downgrades do nothing because the package is superseded by a newer
version, but still don't exit non-zero. The only way to downgrade is to
force the installation, which requires us to ignore dependencies. As
this isn't palatable, we now explicitly fail if we see that the
package was superseded by a newer version.

This also fixes an issue of using << vs. +=, which would cause the
resource's name to be modified during installation.
(AIX) Convert rpm comparisons (regex -> semver)

Prior to this commit, the RPM package provider was using regular
expressions for comparing versions of the `rpm` utility. The regex
method, while functional, is not exactly readable nor does the regex
hold up once `rpm` hits version 10. This commit uses SemVer (even though
the `rpm` versions are *semantically* versioned, the SemVer library
already exists and can easily handle version comparisons) for checking
the specific cases of `rpm` versions < 4.1 and < 4.0.2.
(AIX) backport of master rpm_spec + fix for 2.7.x

This commit can, and should, be trashed when we merge the aix
integration branch into master.
(AIX) Add option tests for various crusty RPMs

Prior to this commit, we had no tests for the changing behaviour based
on version of RPM release. This commit add tests for magical old
versions of RPM, like that on AIX, 3.0.5 aka before the time began.
(AIX) Change ternary to unless for old RPMs

Prior to this commit, the RPM package provider used a less readable
ternary operator for determining which flags to pass to `rpm`. This
commit alters each of those to be a simple suffixed `unless` condition.

This commit also includes the more correct `rpm --version` output which
contains a "\n", and the corresponding `strip` on the version number.
(AIX) Exclude arch from uninstall on old RPMs

Prior to this commit, the RPM provider assumed that `rpm` would
know what to do with the architecture (e.g. i386, x86_64, ppc)
when uninstalling a packages (e.g. `rpm -e mypkg.i386`).
Unfortunately, this only works for relatively modern versions of
`rpm` (4.2.1+).  This commit checks the version of `rpm` and will
add or exclude the architecture from the arguments sent to `rpm`.
(AIX) Remove RPM test from yum spec

Prior to this commit, the yum package provider spec was testing
functionality that did not exist in the yum package provider, but
rather in its parent, the rpm package provider. This commit removes
that test because now we have a proper rpm provider spec.
(maint) RPM install should have --oldpackage

Prior to this commit, the RPM package provider would force the
`--oldpackage` option; however, older versions of RPM (i.e. 3.0.5 on
AIX) don't really like `--oldpackage` when you're doing an installation.
Rather than treat it as a NOOP, the older versions of RPM fail. This
commit changes the behaviour so that `--oldpackage` is only used when
the package is an up-/down-grade.
(AIX) Tests for proper usage of --oldpackage w/ RPM

Prior to this commit, there were no tests for installing packages
with the RPM package provider. This commit adds tests to validate
that when a package doesn't already exist `rpm` is called with
`-i`, and when any version is already installed `rpm` is called
with `-U --oldpackage`. These tests are important because older
versions of RPM, such as 3.0.5 on AIX, barf when `--oldpackage` is
applied with `-i` whereas newer versions of RPM simply treat it as
a NOOP because it doesn't make sense with `-i`.
(AIX) Replace RPM SemVer comparisons with versioncmp

Prior to this commit, the RPM package provider was using SemVer
for determining if version numbers less than specific versions to
enable or disable specific flags. Unfortunately, SemVer requires
version numbers to have, at a minimum, x.y.z and several releases
of RPM only have x.y, causing SemVer to barf.  This commit retains
the logic (and adds tests), but uses the more lenient
`Puppet::Util::Package.versioncmp` instead.
(#6936) Fix undefined method "groupname_by_id" error on AIX user provider

Without this patch, `puppet resource user lindsey gid=4242 ensure=present` fails with the following error:

`err: /User[lindsey]/gid: change from 600 to 4242 failed: undefined method 'groupname_by_id' for #<Puppet::Type::User::ProviderAix:0x20eae6e0>`

This patch fixes the problem by fixing the method definition which makes the above command succeed:

`notice: /User[lindsey]/gid: gid changed '600' to '4242'`
(AIX) (#11581) Fix undefined method "list_all" error on AIX user provider.

Without this patch, `puppet resource user` fails with the following
error:

`./lib/puppet/provider/aixobject.rb:291:in 'instances': undefined
method 'list_all' for Puppet::Type::User::ProviderAix:Class (NoMethodError)`

This patch fixes the problem by fixing the method definition which
makes the above command succeed and list all of the user resources.
(AIX) Convert RPM flags to array

Prior to this commit the flags passed to `rpm` during upgrade or
downgrade were a monolithic string of "-U --oldpackage". The
provider attempts to send this to RPM as a single flag, which
causes `rpm` to barf.  The commit changes the flags sent to `rpm`
to an array of strings, which allows upgrades and downgrades to
actually function as expected.
Add an acceptance test for the aix package provider

This file provides a baseline of test coverage for the aix package
provider, including installation, upgrade, downgrade (which ought to
fail) and removal, all using puppet apply.