Commit graph

4037 commits

Author SHA1 Message Date
Clinton Wolfe
6ca16792e7 Only activate train user plugin gems after we have determined if they are system or user
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-13 18:38:55 -05:00
Chef Expeditor
517e0733fe Bump version to 4.18.93 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-13 21:25:34 +00:00
Chef Expeditor
3f05bb1f75 Bump version to 4.18.92 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-13 20:13:07 +00:00
Clinton Wolfe
03d394a51b
Fix auditd resource processing of action and list (#4665)
Fix auditd resource processing of action and list
2020-02-13 15:12:47 -05:00
Chef Expeditor
94dbbccfca Bump version to 4.18.91 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-13 18:46:27 +00:00
Ross Moles
71ee45c70e Add missing @ to bin in command builder
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-13 15:49:26 +00:00
Ross Moles
f0293e0e5a remove send
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-13 10:29:09 +00:00
Ross Moles
87998c9830 update unit test
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-12 18:18:54 +00:00
Ross Moles
babd4aebf8 resolve code climate errors
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-12 17:12:12 +00:00
Ross Moles
f375a471e1 Refactor oracledb_session resource
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-12 16:24:23 +00:00
Chef Expeditor
b557eaff7e Bump version to 4.18.90 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-11 21:07:54 +00:00
Chef Expeditor
38919fbd18 Bump version to 4.18.89 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-11 03:13:05 +00:00
Ryan Davis
3e3dbdc8f1
Merge pull request #4898 from inspec/zenspider/system-plugin/fixes
Distinguish between user plugin gems and system gems and load system gems normally.
2020-02-10 19:12:49 -08:00
Chef Expeditor
2c7336ad32 Bump version to 4.18.88 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-11 02:57:42 +00:00
Chef Expeditor
a27562339b Bump version to 4.18.87 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-11 02:38:50 +00:00
Miah Johnson
7bb0bb2188
Merge pull request #4865 from inspec/jh/schema-improvements
Jh/schema improvements
2020-02-10 18:38:28 -08:00
Miah Johnson
bf7931bc76 ui doesn't exist here yet, we're pre-ui'ish. So lets just call exit
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-10 14:55:27 -08:00
Miah Johnson
8be265772b fixup_train_plugin_status should not activate gems.
This is handled by load_all already.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-10 14:52:12 -08:00
Chef Expeditor
969b9056c8 Bump version to 4.18.86 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-10 20:36:23 +00:00
Clinton Wolfe
774b5944fb
Detect install type via install path (#4856)
Detect install type via install path
2020-02-10 15:36:04 -05:00
Ryan Davis
3eac105498 Distinguish between core gems and system gems and load system gems normally.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-07 14:40:56 -08:00
Chef Expeditor
961b3662c4 Bump version to 4.18.85 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-06 20:25:55 +00:00
Clinton Wolfe
8a05908a87 Don't try to fool Thor's option type checker for --airgap on archive command
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-06 11:02:50 -05:00
Miah Johnson
4f642e0942 Clean up schema PR.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-05 17:06:55 -08:00
Jacob Henry
724f82237b Revision of schema to JSON Schema draft 7
Signed-off-by: Jacob Henry <jchenry@mitre.org>
2020-02-05 17:05:47 -08:00
Clinton Wolfe
f8d99eabb9 Move path_exist test code into test file
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-05 12:15:48 -05:00
Chef Expeditor
3f1349b054 Bump version to 4.18.84 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-04 19:54:51 +00:00
Chef Expeditor
9f2b621f9b Bump version to 4.18.83 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-04 00:42:29 +00:00
Ryan Davis
cac6b88c03 Fixed error on ruby 2.4 because define_method was private.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
89a0b44c64 Refactored and moved Resource.create_dsl to ProfileContext.
ProfileContext#to_resources_dsl is the only usage of it.
The responsibility for this code should be on ProfileContext.

Refactored a majority of #create_dsl to be a 2-line long Module.new
instead of 36 lines. Much less magic. Still has an anonymous module
but it is now much easier to address and debug.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
fa3122cbff Removed metaprogramming in Inspec::Backend.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
cea752a01d Tweak for aws resources to determine if they're still under test.
Everyone now has an `inspec` method, but the AWS ones still return
nil as their backend hasn't been set up.

This seems wrong...

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
950c79319e Moved __register down to bookkeeping section.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
b38a3b05f9 Reworked Resource.__register's metaprogramming to be as small as possible.
Mostly involved pushing up all the regular initialize code to a
regular method, calling that, THEN doing super up to the resource
initialize.

This brings __register's Class.new to 5 lines.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
43f520b4a8 Merged Inspec::Plugins::Resource to Inspec::Resource.
This also removes Inspec::ResourceBehaviors and Inspec::ResourceDSL.

All class methods look like class methods.
All instance methods look like instance methods.

There is still too much clever going on with __register creating
another anonymous subclass, but I think I can work that out/down too.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
44a006a05a Rename Inspec::Resource.supports to support_registry.
To fix an already existing name collision between Inspec::Resource and
Inspec::Plugins::Resource.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
f0a5ddd4df Simple refactoring + assign __resource_registry to the current if needed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
81dfe21a98 First pass reworking LibraryEvalContext.
This takes 3 anonymous Class.new w/ no superclasses, no documentation,
and no obvious clue as to what anything is and drops it down to 2
Class.new w/ superclasses, documents what it can, and makes it much
more clear what is going on. (yet, still not clear)

It also actually uses LibraryEvalContext. Having names is important.
Probably more important than any of the rest of this diff.

One extra thing this adds is Module.find_class_instance_variable and
hooks it up to Resource.__resource_registry. This allows it to find a
class-level registry regardless of whether it was hidden in an
anonymous superclass or not.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
07631a53e7 Added extra doco on our require method.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
d7bae9de30 Mostly minor cleanup, clarification, and comments.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
fdc281d19c Clean up the end of our custom require.
There are only 2 options. Shortcutting one of them with a `require` just
makes it messy. Use `if`. It's really basic. Basic is good. Maybe we
should try to push towards basic and good. It would be work but make
us happier in the long run.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
51b65f6c2e Overhaul Platform#supported?
+ State normal path first.
+ Use Enumerable to state your logic up front, don't build it into
  loops with breaks/returns.
+ Remove nonsensical duplication of key formats. (should push up or remove)
+ Had to add an extra test case that wasn't covered here but was in
  metadata_test.rb (why?!?)

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
10cb92da48 Clean up Platform#params.
State your normal case first, then deal with edge cases, not the other
way around.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
aef285a1f6 Don't meta-program if you don't need to.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
06ceba3f3d Add test for LEC to expose second-level libraries require.
Not the best test in the world, but it is better than nothing.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Chef Expeditor
3cfd35f98f Bump version to 4.18.82 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-01 02:04:23 +00:00
Ryan Davis
2c7101df26 Fix minor style issues.
I swear... rubocop hates me.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-31 18:01:01 -08:00
Chef Expeditor
4ab4b04bed Bump version to 4.18.81 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-01 01:51:56 +00:00
Chef Expeditor
d09656cdff Bump version to 4.18.80 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-01 01:38:34 +00:00
Ryan Davis
c79245cde3
Merge pull request #4869 from inspec/zenspider/crontab
Refactored crontab resource
2020-01-31 17:38:12 -08:00
Chef Expeditor
c3a37ee126 Bump version to 4.18.79 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-01 00:42:32 +00:00
Ryan Davis
c70f73dc96
Merge pull request #4864 from inspec/zenspider/resource/inspect
Added --inspect option to inspect shell command.
2020-01-31 16:42:00 -08:00
Chef Expeditor
01b9bacaa1 Bump version to 4.18.78 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-02-01 00:41:46 +00:00
Ryan Davis
cc1393bb9a
Merge pull request #4822 from PiQuer/master
make command.exist? POSIX conform
2020-01-31 16:41:27 -08:00
Chef Expeditor
09e0bc63da Bump version to 4.18.77 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-31 22:29:39 +00:00
Chef Expeditor
d83ead45f9 Bump version to 4.18.76 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-31 01:21:42 +00:00
Chef Expeditor
7e258f8944 Bump version to 4.18.75 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 16:04:33 +00:00
Chef Expeditor
f69d76e4a0 Bump version to 4.18.74 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 00:36:49 +00:00
Ryan Davis
a79eb417a0 the correct, un-panicked fix.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-29 16:35:11 -08:00
Chef Expeditor
fb81c806b5 Bump version to 4.18.73 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 00:25:39 +00:00
Ryan Davis
622ae78d9a bad master merge... rushing this through
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-29 16:24:35 -08:00
Chef Expeditor
5c6be7b936 Bump version to 4.18.72 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 00:19:44 +00:00
Ryan Davis
f2155a64ed
Merge pull request #4843 from michaellihs/master
Add support for yocto linux in service resource
2020-01-29 16:19:27 -08:00
Ryan Davis
19ce5df589
Merge pull request #4827 from inspec/mj/namespaces
Move parsers under Utils
2020-01-29 16:18:43 -08:00
Chef Expeditor
bb70c50961 Bump version to 4.18.71 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 00:08:10 +00:00
Ryan Davis
10406545ca
Merge pull request #4862 from inspec/zenspider/resources
Fix up the platform on etc_hosts, virtualization, ini, and xml resources to fix OS disparity.
2020-01-29 16:07:47 -08:00
Chef Expeditor
eaf2d7ca5b Bump version to 4.18.70 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-30 00:06:50 +00:00
Chef Expeditor
485aa93d90 Bump version to 4.18.69 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-29 23:50:00 +00:00
Ryan Davis
124b56b6ee
Merge pull request #4825 from inspec/zenspider/tarball
Properly report errors with bad tarball files.
2020-01-29 15:49:40 -08:00
Ryan Davis
2ae2bcf6fb
Merge pull request #4818 from JackChance/master
replaced instances of `have_protocols` with `have_protocol` in docume…
2020-01-29 15:46:25 -08:00
Ryan Davis
ceab1cbdac Refactored crontab resource
Specifically the parsing was pretty unreadable. This refactoring
emphasizes using a default hash and merging in the differences for
what was parsed. Everything is funneled through one `merge_crontab`
method that does the actual parsing and the system vs user differences
are merged in after in their respective parse methods.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-29 13:56:11 -08:00
Clinton Wolfe
37455bdd11 Parallelize unit tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-29 16:15:58 -05:00
Clinton Wolfe
3419c84233 Make predicates private to reduce namespace pollution; added dockerenv check for docker mode
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-29 11:28:52 -05:00
Chef Expeditor
193905a827 Bump version to 4.18.68 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-29 16:03:44 +00:00
Ryan Davis
15f77941af Some cleanup on the apache_conf resource.
The biggie to know is that all the extra read_content calls were
needlessly redundant with it also being called in initialize.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:53:37 -08:00
Ryan Davis
9c051da22b Fix platform on apache_conf to include all unix.
Now discovers the first available conf file from a list of known
paths. Might have to expand based on various distros.

Had to tweak the tests because the mock loader mocks EVERYTHING every
time. :/

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:53:37 -08:00
Ryan Davis
8bd2528ef8 Added --inspect option to inspect shell command.
* Removed Resource#inspect (calling to_s) to make debugging a happy experience.
* Added ResourceBehavior.toggle_inspect to add/remove a basic inspect.
* Added `--inspect` flag to `shell` command. Call toggle_inspect unless --inspect used.
* Cleaned up matchers.rb and removed most explicit calls to inspect.
* Added ResourceInspector to rspec's INSPECTOR_CLASSES.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:52:04 -08:00
Clinton Wolfe
357cf051b1 PR feedback part 1
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:06:12 -05:00
Chef Expeditor
41f3927e84 Bump version to 4.18.67 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-28 15:03:18 +00:00
Clinton Wolfe
46ade02401
Use an archive if possible when fetching fails and --airgap is… (#4806)
Use an archive if possible when fetching fails and --airgap is provided
2020-01-28 10:02:57 -05:00
Ryan Davis
df31f744f4 Fix up platform on filesystem resource.
From linux to unix. This should work fine even on AIX, according to
the man pages.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:34:33 -08:00
Ryan Davis
65c44d22e2 Audited virtualization a bit.
Cleaned up some code.
Reordered virtualization detection by order of probability.
Added TODOs for obvious problems.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:31:41 -08:00
Ryan Davis
f830ddeca6 Slimmed up and removed "clever" from file resource description.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:30:48 -08:00
Ryan Davis
b9d49e0fed Fix up the platform on etc_hosts, virtualization, ini, and xml resources to fix OS disparity.
+ File format oriented resources should always be `os`.
+ virtualization should (in theory) be any unix (tho, it currently seems wrong).
+ etc_hosts should be any (reasonable) unix.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:29:52 -08:00
Clinton Wolfe
76a9c3e590 Install-path based install context detection
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-27 13:29:37 -05:00
Clinton Wolfe
eac3b31095 PR feedback re: cache warming
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-27 11:01:15 -05:00
Chef Expeditor
2089bf80c7 Bump version to 4.18.66 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-27 15:51:46 +00:00
Clinton Wolfe
31d2383285
Missing end quote in oracledb_session (#4852)
Missing end quote in oracledb_session
2020-01-27 10:51:25 -05:00
Chef Expeditor
cafb4f3e3e Bump version to 4.18.65 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-27 15:31:19 +00:00
Miah Johnson
89549bd884 Missing end quote.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-01-24 12:00:00 -08:00
Chef Expeditor
6434009051 Bump version to 4.18.64 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-24 17:40:12 +00:00
Ryan Davis
faf7833559 Clarified service logic logic for redhat flavors.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-23 16:36:44 -08:00
Ryan Davis
ad6ffcccd6 Switch Service#select_service_mgmt from huge if statement to case.
Having a ton of conditions with `%w{one-string}.include?(platform)` is
incredibly wasteful and slow. Apparently about 17x slower:

```
Calculating -------------------------------------
          include_eh    529.315k (± 3.2%) i/s -      2.675M in   5.058296s
       include_or_eq    909.795k (± 1.5%) i/s -      4.568M in   5.022491s
           case_when      9.043M (± 2.8%) i/s -     45.443M in   5.029499s

Comparison:
           case_when:  9042590.3 i/s
       include_or_eq:   909795.2 i/s - 9.94x  slower
          include_eh:   529315.0 i/s - 17.08x  slower
```

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-23 16:36:36 -08:00
Ryan Davis
8f4bac23eb Refactor some of resources/service.rb
Starting with: normalizing a huge if in select_service_mgmt to only
use strings.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-23 16:33:15 -08:00
Chef Expeditor
d013ac1e47 Bump version to 4.18.63 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-23 18:09:12 +00:00
Noel Georgi
7ac25401bb
Add: content option for x509_certificate
Signed-off-by: Noel Georgi <git@frezbo.com>
2020-01-22 13:49:35 +05:30
Chef Expeditor
7da7c2774b Bump version to 4.18.62 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-21 21:18:34 +00: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
Chef Expeditor
356de23c5c Bump version to 4.18.61 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2020-01-15 21:02:41 +00:00