This resolves#5235 and supersedes #5238.
Instead of using `-match` use `-like` when querying the Windows registry. This
completely removes the problem of trying to clean the string for a regex and
just let's Powershell do that with `-like`.
I confirmed this works with the use case of having a package name such as
`Microsoft Visual C++ 2015-2019 Redistributable (x86) - 14.28.29325` work as-is
without any modification.
Signed-off-by: Lance Albertson <lance@osuosl.org>
added unit test for platform-name wildcard
added doc for release wildcard
added doc for platform-name wildcard
Signed-off-by: superyarick <yarick@yarick.net>
On some systems the output of ps may be truncated, which may prevent
profiles from working as intended.
Some implementations specifically mention that the output width is
undefined "(it may be 80, unlimited, determined by the TERM variable,
and so on)".
This fixes#5226.
Signed-off-by: Raphael Geissert <atomo64@gmail.com>
macOS 11 Big Sur will be released later this year. Current beta versions
return 10.16 as the version, but the product name has changed from 'Mac
OS X' to 'macOS'. Train probably needs to be modified to deprecate
'mac_os_x' as a platform in favor of 'macos' but that would be a
significant downstream change. Train does fall back to 'darwin' on macOS
10.16, so by adding darwin to the list of platform names for the service
resource we are able to work around this for the moment.
This is the only location where mac_os_x is currently being used in
InSpec. Because we're in a case statement on platform rather than the
more generic platform family, we can't simply remove mac_os_x in favor
of darwin.
Signed-off-by: Bryan McLellan <btm@loftninjas.org>
With the current implementation, on a Linux system without bash
command.exist? always returns false. 'sh -c' is guaranteed to exist on a
POSIX-conform system [1] whereas 'bash -c' only works if bash is
actually installed.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html
Obvious fix.
The output for ``yum -v repolist all`` changes slightly in CentOS 8. There are
two specific changes:
1. EL8 is no longer trailing the repo name with release version and arch (i.e.
base instead of base/7/x86)
2. EL8 no longer adds a trailing newline on the last repo and instead has a line
with ``Total packages:``. This means the repo listed last will never show up.
A fix was introduced in #4566 however the tests still use CentOS 7 yum output
instead of dnf repolist output. One issue was still discovered where it was
including the ``Total packages`` line in the last repository. This includes a
regex for to work around that and fixes for the tests.
Signed-off-by: Lance Albertson <lance@osuosl.org>
Extended quick_resource to have platform methods and a new string
command mock. The named resource to mock may now be a symbol.
Added a new test that shows how to use quick_resource with multiple commands.
Fixes#4629.
Signed-off-by: Ryan Davis <zenspider@chef.io>
* Renamed and added extra test data to distinguish between centos 7 & centos 8.
* Renamed and added extra tests to cover centos 8.
* Fixed missing repo data by checking at the end if we were still in parse mode.
Fixes#4517
Signed-off-by: Ryan Davis <zenspider@chef.io>
Cc: Miah Johnson <miah@chia-pet.org>
Removes pre-loading and registration of resources by adding
method_missing to a couple key areas.
This still drops the ball in some areas, but it is a start.
Pass the first argument of the opts array instead of the whole array which
confuses the SimpleConfig parser. Also added a test which verifies this fixes
the issue.
In addition, change the base_name to something that matches other resource base
names.
Signed-off-by: Lance Albertson <lance@osuosl.org>