Commit graph

165 commits

Author SHA1 Message Date
Clinton Wolfe
3664b0c47d
Merge pull request #5758 from inspec/nm/timezone-resource
Added Timezone Resource
2022-01-09 20:45:15 -05:00
Nikita Mathur
4b9692c6fd Added kernel parameters resource
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-31 14:57:57 +05:30
Nikita Mathur
d1cee33462 Test fixes
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-22 13:48:07 +05:30
Nikita Mathur
b0794c2262 Latest package info test cases for resource
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-21 16:40:58 +05:30
Clinton Wolfe
a8170b257c
Merge pull request #5757 from inspec/vasundhara/add_proxy_parameter_to_http_resource
Add proxy parameter to http resource
2021-12-14 04:30:06 -05:00
Nikita Mathur
2d798c3b32 Fix: Alpine packages list command to only list installed packages
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-13 16:02:18 +05:30
Vasu1105
b19b8ba55d Fixed lint and failing test
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-12-13 11:39:59 +05:30
Nikita Mathur
4743da84f7 Added windows platform support for timezone resource
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-07 18:16:46 +05:30
Nikita Mathur
4008af0be8 Implemented timezone resource to test timezone configuration values
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-12-06 14:38:15 +05:30
Nikita Mathur
e122d34a3d Alpine support extended for os based resources
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-11-24 17:13:54 +05:30
Vasu1105
e7c2729f51 Fixed failing test
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-11-23 17:05:39 +05:30
Clinton Wolfe
8730e4acf0
Merge pull request #5606 from zofrex/fix-service-enable-check-freebsd
Fix FreeBSD service enabled check substring edge-case
2021-11-20 02:04:17 -05:00
Kimberly Garmoe
b3b470548c
Merge pull request #5697 from inspec/vasundhara/add-http-for-windows
Add Windows support for http resource.
2021-11-15 17:12:02 -08:00
Vasu1105
c8495965d8 Fixed indentation and lint issues
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-10-13 19:27:29 +05:30
Vasu1105
f35eef20ff Adds windows support for http resource. Adopted PR #5280. Updated the code to handle post request,
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-10-13 18:26:38 +05:30
James 'zofrex' Sanderson
acf5a2c955 Fix Rubocop issues
Signed-off-by: James 'zofrex' Sanderson <zofrex@gmail.com>
2021-10-13 08:57:51 +01:00
James 'zofrex' Sanderson
41ea0da4a9 Fix FreeBSD service enabled check substring edge-case
* Now services named a suffix of another service don't have false positives for being enabled
* Use new 'enabled' service command on FreeBSD 10+

Signed-off-by: James 'zofrex' Sanderson <zofrex@gmail.com>
2021-10-13 08:57:51 +01:00
Clinton Wolfe
6414e3a5ab
Merge pull request #5681 from inspec/vasundhara/update-tests-files
Update the unit test files to use latest versions of OS rather than the older.
2021-10-05 22:02:22 -04:00
Clinton Wolfe
a79be0ca96
Merge pull request #5683 from inspec/nm/cassandra-resource
Add support for Cassandra DB
2021-10-05 21:55:24 -04:00
Vasu1105
9b66e2830c Merge branch 'add-http-for-windows-2' of github.com:mbaitelman/inspec into add-http-for-windows 2021-10-01 16:03:55 +05:30
Nikita Mathur
b4ca1914c4 Add support for Cassandra DB resources
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-09-30 16:09:08 +05:30
Vasu1105
ff65112ab5 Updated test files to use Ubuntu latest version while mocking the OS instead of Ubuntu1804
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-30 15:05:27 +05:30
Vasu1105
86391be836 Updated test files to use Ubuntu latest version while mocking the OS instead of Ubuntu1604
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-30 14:50:03 +05:30
Vasu1105
584bbfa3a3 Updated test files to use Ubuntu latest version while mocking the OS instead of Ubuntu1404 whereever required.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-30 14:26:43 +05:30
Vasu1105
fe555a3780 Remove the unit test added for Ubuntu using older version i.e 15.04.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-29 12:53:58 +05:30
Vasu1105
63e7eb5395 Fix opa_api and opa_cli resource to handle empty result
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-22 16:23:12 +05:30
Clinton Wolfe
49cd6883b9
Merge pull request #5589 from collinmcneese/cmcneese/chrony_conf
adds chrony_conf InSpec resource
2021-09-13 14:39:34 -04:00
Clinton Wolfe
ceaef891bb
Merge branch 'main' into nm/oracle-conf 2021-09-13 14:33:51 -04:00
Vasu1105
10d96ece3f Add windows platform support for ibmdb2_conf and ibmdb2_session resource
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-01 18:06:16 +05:30
Vasu1105
12e3ee9aca Fix the command to query on the database
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-01 18:06:16 +05:30
Vasu1105
763f221810 Fix lint errors
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-01 18:06:16 +05:30
Vasu1105
30ea9cfe57 Add ibmdb2_conf and ibmdb2_session resource
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-09-01 18:06:16 +05:30
Mendy Baitelman
7abebdf80b Merge remote-tracking branch 'upstream/main' into add-http-for-windows-2 2021-08-31 17:08:28 -07:00
Vasu1105
2100a66bef Removed use of wmic from security_identifier resource as it will be deprecated soon
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-08-30 12:47:03 +05:30
Clinton Wolfe
77297cfef0
Merge pull request #5578 from elsnepal/aliyun3
Add aliyun3 support to service resource
2021-08-23 22:49:28 -04:00
Clinton Wolfe
dcf49ad510
Merge pull request #5601 from inspec/nm/bug-apache-conf
Fix apache_conf issue when Server Root is not present in configuration
2021-08-17 21:00:38 -04:00
Clinton Wolfe
e1f63cc7a5
Merge pull request #5592 from inspec/vasundhara/add_OPA_support
Add support for OPA: add resource opa_cli and opa_api
2021-07-27 22:47:23 -04:00
Nikita Mathur
aa888cf909 Build fix - virtulization test was failing
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-07-22 13:32:23 +05:30
Nikita Mathur
82db157c06 Apache conf doc changes for server root requirement and review changes
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-07-19 17:56:13 +05:30
Vasu1105
6ed14dc7de Fix lint
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-07-19 15:01:31 +05:30
Vasu1105
f0ca02a1c5 Adds unit test for opa_api and opa_cli resource
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-07-19 14:44:47 +05:30
Nikita Mathur
1e8363587e Test case to test apache_conf when server root is not configured
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-07-19 14:41:29 +05:30
Will Dower
82f3548118 add
Signed-off-by: Will Dower <wdower@mitre.org>
2021-07-12 11:13:47 -04:00
Will Dower
bdd01b3220 Merge remote-tracking branch 'upstream/master' into firewalld_update
Signed-off-by: Will Dower <wdower@mitre.org>
2021-07-09 15:34:06 -04:00
Nikita Mathur
89b0f95c75 Using os_env resource to read ORACLE_HOME env in oracle listener conf resource
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-07-09 16:31:45 +05:30
Daniel Tingstrom
3e8738a4e6 Update firewalld resource to include more properties
Signed-off-by: Daniel Tingstrom <dtingstrom@mitre.org>
2021-07-08 16:50:48 -04:00
Collin McNeese
06eb9b9a84
adds chrony_conf InSpec resource
Signed-off-by: Collin McNeese <cmcneese@chef.io>
2021-07-06 10:46:47 -05:00
Nikita Mathur
f3633aa096 File existence check and other null checks
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-07-02 15:15:19 +05:30
Vasu1105
6bfc2fad2f Fixed failing specs
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-07-01 15:28:58 +05:30
Nikita Mathur
cb31cefaa2 Review changes - Fetching listener file using env variable
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-06-29 14:43:56 +05:30
Nikita Mathur
f921c25efc Oracle_db_conf and oracle_listener_conf changes, test cases and doc added
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2021-06-29 12:25:48 +05:30
Ashish Nepal
80b00794d5 add aliyun3 support 2021-06-26 20:30:57 +01:00
Vasu1105
da00e359aa Add mongodb_conf resource to InSpec
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-06-14 18:17:05 +05:30
Vasu1105
da75f0ce33 Removed old ubuntu version from mock_loader file as it's not getting used and added new version of Ubuntu in mock_loader file.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-05-17 11:28:39 +05:30
Vasu1105
7990b31f5f Updated test to mock the newly added command
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-05-17 11:12:27 +05:30
Kannan Ramakrishnan
d1831a318c Lint errors handled. Signed-off-by: @kannanr <kannaa.ram@gmail.com> 2021-05-15 17:48:19 +05:30
Kannan Ramakrishnan
19c624cf38 Support zfs_pool and zfs_dataset resources on Linux. Handled #5075. Signed-off-by: @kannanr <kannaa.ram@gmail.com> 2021-05-15 12:18:39 +05:30
Vasu1105
a09fb159d3 Fix lintstyle
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-04-22 12:53:08 +05:30
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
mbaitelman
974d78af76 Add head test
Signed-off-by: mbaitelman <mendy@baitelman.com>
2021-03-09 21:42:50 -08:00
mbaitelman
ad1bf219eb Merge remote-tracking branch 'upstream/master' into add-http-for-windows-2
Signed-off-by: mbaitelman <mendy@baitelman.com>
2021-03-08 06:47:36 -08:00
mbaitelman
4ad11e8103 fixed tests
Signed-off-by: mbaitelman <mendy@baitelman.com>
2021-03-07 23:58:50 -08: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
mbaitelman
89cb81ca33 Update to return JSON, start writing tests
Signed-off-by: GitHub <noreply@github.com>
2020-10-16 18:01:38 +00: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
Miah Johnson
44579ab4b3
Merge pull request #4637 from inspec/mj/3921
Fix filesystem resource when device has long name
2019-10-24 13:24:23 -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
8d51d878f6 Fixed users resource when "Last password change" is "never".
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>
2019-10-23 16:49:49 -07:00
Ryan Davis
fe34eb7869 Moved quick_resource and Fake helpers to test/helpers/resources.rb
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-16 16:54:07 -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