Commit graph

49 commits

Author SHA1 Message Date
Vasu1105
76dca7f97c Adds policy property, unit test and documentation for modules and booleans
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-04-22 11:40:32 +05:30
Vasu1105
58e30cfa81 Review comments fixed
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-04-21 11:43:03 +05:30
Vasu1105
c963b2ac14 fix linting
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-04-21 11:43:02 +05:30
Vasu1105
cbe7e8c03f Add selinux resource with basic features support
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-04-21 11:43:02 +05:30
Yoshi Yamaguchi
68aa7ca14b Change test to be consistent with the main implementation
Signed-off-by: Yoshi Yamaguchi <yoshifumi@google.com>
2021-03-19 17:37:06 +09:00
Clinton Wolfe
cdfb325ca3 Apply chefstyle -a, and manually remove duplicate requires
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-12-21 13:25:04 -05:00
Nick Schwaderer
c766519485
Merge pull request #5302 from yarick/yt/wildcart_support_platform_name
Added platform-name wildcard support
2020-12-03 13:17:02 +00:00
Alex Pop
9438c81a0f Fix mock sha256
Signed-off-by: Alex Pop <apop@chef.io>
2020-12-02 09:29:16 +00:00
superyarick
e7e196334a Merge remote-tracking branch 'upstream/master' into yt/wildcart_support_platform_name
Signed-off-by: superyarick <yarick@yarick.net>
2020-12-01 18:29:44 -05:00
Lance Albertson
a6cff007ed Fix Windows escaping of Windows package names
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>
2020-11-30 18:02:50 -08:00
superyarick
c653ce343a added platform-name wildcard support
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>
2020-11-08 15:24:43 -05:00
Raphael Geissert
b2e62b5b2f Run ps with an ulimited width on linux
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>
2020-09-02 08:34:11 +02:00
Felipe Zipitria
d2ae7a7fbf
fix(osfamily): use corresponding family or name for bsd/freebsd
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-07-22 08:43:25 -03:00
Bryan McLellan
dada8ea074 Add the generic 'darwin' to the service resource
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>
2020-07-02 09:36:27 -04:00
Clinton Wolfe
d9007588a6 Add an heuristic-based IP lookup property
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
52468e470e Barebones plural interfaces resource
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
a4000d6912 Adds support for interface on BSD and MacOS
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Ryan Davis
cc1393bb9a
Merge pull request #4822 from PiQuer/master
make command.exist? POSIX conform
2020-01-31 16:41:27 -08:00
Raimar Sandner
fa2f2c2caa make command.exist? POSIX conform
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.
2020-01-19 00:05:33 +01:00
Michael Lihs
edd93eea81 Add support for yocto linux in service resource
Signed-off-by: Michael Lihs <michael.lihs@thoughtworks.com>
2020-01-18 01:26:16 +01:00
Ryan Davis
313f3462ca Cache MockLoader.connection.
Speeds up test/unit/profile/profile_context_test from 7-8s to 0.5s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Felipe Zipitria
bff3fa960d
Add suport for freebsd package resource
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2019-12-17 08:39:43 -03:00
Mendy Baitelman
6baf0f8a1c Fix tests
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-14 21:22:07 -08:00
Clinton Wolfe
1db2941a9e
Fix for invocation when calling npm under sudo (#4548)
Fix for invocation when calling npm under sudo
2019-11-12 16:01:07 -05:00
Ryan Davis
b1c2af209b Corresponding fixes for the move from test/unit/mock to test/fixtures.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 19:20:12 -08:00
Clinton Wolfe
f85de31292 Update test mock file to match invocation
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-07 15:39:08 -05:00
Miah Johnson
de4139aff8
Merge pull request #4568 from ramereth/yum-el8-support
Improve testing for yum.repo in CentOS 8
2019-10-31 14:13:05 -07:00
Lance Albertson
dab91a321a Improve testing for yum.repo in CentOS 8
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>
2019-10-24 08:22:42 -07:00
Miah Johnson
8e31367b51 Use new mock loader, update the command name
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-23 21:42:10 -07:00
Ryan Davis
fc8ea79ad0 Fixed parsing yum output on centos8.
* 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>
2019-10-16 16:54:07 -07:00
Ryan Davis
f5bbfe5fac
Merge pull request #4365 from inspec/zenspider/the-need-for-speed
Make inspec much faster for most commands.
2019-09-09 18:02:10 -07:00
Ryan Davis
b6bfeffd9e Make inspec much faster for most commands.
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.
2019-09-04 15:44:26 -07:00
Lance Albertson
1e94e3503e Fix for postfix_conf when using a non-standard config location
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>
2019-09-03 15:28:44 -07:00
David Gasper
52ae5e434b Add docs and unit tests, remove .travis.yml
Signed-off-by: David Gasper <dmgasper@osuosl.org>
2019-08-08 13:54:35 -07:00
Mendy Baitelman
4d990865a1 Add to mock_loader
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 19:44:02 -07:00
Clinton Wolfe
be91550343
windows_task: Fix handling of multiple triggers (#4242)
windows_task: Fix handling of multiple triggers
2019-07-29 13:00:16 -04:00
Eike Waldt
da4168f83d
add darwin/OSX tests
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:19 +02:00
Eike Waldt
b47cf6e80e
change from dmidecode to /sys/class/dmi/id/*
(kudos to Seife)

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:03 +02:00
Eike Waldt
9278d8109d
add tests for resource sys_info.manufacturer and sys_info.model
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:45 +02:00
Miah Johnson
a4f4fe5231 chefstyle -a; https://github.com/chef/chefstyle/pull/74
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-07-08 17:22:50 -07:00
Miah Johnson
8272d0184b
Merge pull request #4236 from ramereth/ip6tables
Add ip6tables resource
2019-07-08 11:45:33 -07:00
Jerry Aldrich
668b8d82bf windows_task: Fix handling of multiple triggers
When using `schtasks` a list is returned if the task has multiple
triggers. This merges that list with the last item taking precedence.
This is how `Get-ScheduledTask` behaves.

Initially, I was going to rewrite this resource to use
`Get-ScheduledTask` but the original author purposely did not do this
so that PowerShell v3 would be supported. We only support PowerShell
v5, but I don't want to break any current users and this change didn't
seem to controversial to me.

If it gives us trouble, I recommend rewriting it to use
`Get-ScheduledTask`.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-06-28 00:27:53 -07:00
Lance Albertson
3263d76627 Add ip6tables resource
This should resolve #1011 which provides an ip6tables resource to test IPv6
iptables rules. This is essentially a copy of the iptables resource with a few
renames.

In addition, I've pulled in the integration tests for iptables into ip6tables
and enabled it on docker so that it properly gets tested regularly. The test
cookbook recipe has been updated to support all of the current platforms that
are being tested.

Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-06-24 17:01:34 -07:00
Jared Ledvina
45713b2627
Service add Debian 10 test
Signed-off-by: Jared Ledvina <jared@techsmix.net>
2019-06-22 13:23:32 -04:00
Jerry Aldrich
80c595ba3d nginx_conf: Fix commented/empty file parsing
This fixes `nginx_conf.params` when:
  - Given an empty file
  - Given a file with only comments
  - Given a file that has an include for a file that:
    - Is empty
    - Has all lines commented out

This also fixes a test where a missing file is actually empty

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-06-17 21:57:26 -08:00
Ryan Davis
fae4230a41 Removing inspec/profile_vendor from inspec/base_cli.
This was the next most expensive require in the analysis.

Also rearranged the way that ui handled tables to be lazy.

```
% SLOW=1 time rake test:functional

before: Finished in  681.514579s, 0.5136 runs/s, 2.9919 assertions/s.
after : Finished in  642.655918s, 0.5446 runs/s, 3.1728 assertions/s.
```

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 19:16:58 -07:00
Ryan Davis
a5309ea392 blindly applied chefstyle -a
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:03 -07:00
Ryan Davis
ad12e601bf Minor cleanup on test/helper.rb
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-28 12:02:06 -07:00
Ryan Davis
09e892032b Extracting mock_loader to its own helper file.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-25 02:59:31 -07:00