Commit graph

451 commits

Author SHA1 Message Date
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
Ryan Davis
6dfa1d8310 Um. No.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
bd79e9c895
Merge pull request #4316 from inspec/zenspider/fix-file-aws
Fix exceptions when resources are used with incompatible transports
2019-07-23 11:47:13 -07:00
Ryan Davis
7de549577c Return keys are really nice.
They make code more readable by visually separating different sections
of text.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07: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
9c06a0c8e2
refactor tests for resource sys_info.manufacturer and sys_info.model
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:52 +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
Eike Waldt
474d70b78d
fix description on sys_info.hostname tests
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 20:39:38 +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
Clinton Wolfe
e4e7c255de Automated chefstyle application for rubocop 0.72 compatibility
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-03 17:24:41 -04:00
Jerry Aldrich
5e93c4b12e Appease RuboCop
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-07-01 22:45:04 -07:00
Jerry Aldrich
dafa4f4165 Try to appease Code Climate
I...I don't know how to make it better.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-07-01 22:39:12 -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
Ryan Davis
902d7b563c Set the umask on travis in before_install.
https://travis-ci.community/t/file-permissions-just-gone-up-to-664/1547/5

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-19 16:40:24 -07: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
Miah Johnson
b21bcfabc4 Lets discuss this next week when we're all around =)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-14 15:04:26 -07:00
Miah Johnson
e46018a517 chefstyle -a cleanup
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -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
Miah Johnson
2a1b1d8e88 Remove all leading newlines.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Ryan Davis
82c9aa6ed6 Got the rest of the tests to pass.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
de8258c9f7 Get yaml_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
761f48e63c Get user_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
adaf2bc364 Removed aws resource requiring from test/helper and inspec/resource.
This speeds up parallel unit test runs from a very consistent 2:49 to
a very consistent 1:53, or a 33% reduction.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Miah Johnson
6c19e81a06 Remove authors tags from source files.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 12:47:39 -07:00
Ryan Davis
f36a7c8061 No tabs.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-25 03:40:36 -07:00
Ryan Davis
e72f3f34aa Skip more_permissive_than? file_test because broken only on CI.
Trying to fix file_test failure that only happens on travis.

The "mock" file in question is supposed to have a stat of 644, but
actually has 664 but only on travis-ci.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 03:19:46 -07:00
Ryan Davis
bc028893e8 Fixed inconsistent use of MT::S's "expect" method (eg _)
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
6235c3f658 Fixed missing requires
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Miah Johnson
bf28482350
Merge pull request #4043 from inspec/ap/no-resource-capitalize
Wrap resources in backticks and remove resource name capitalizing
2019-05-08 23:49:25 -07:00
Alex Pop
d7f06f98f1 Wrap resources in backticks and remove resource name capitalizing
Signed-off-by: Alex Pop <alexpop@users.noreply.github.com>
2019-05-08 20:17:51 +01:00
Miah Johnson
659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00
Clinton Wolfe
843ba7afa2
Improve ss parsing code for IPv6 addresses (#3962)
Improve ss parsing code for IPv6 addresses
2019-04-25 11:09:31 -04:00
Miah Johnson
2f78515164 Add a few tests for LinuxPorts class to validate ss parsing.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-04-19 13:45:33 -07:00
Clinton Wolfe
3d0b8dff2e
Merge pull request #3956 from inspec/cw/use-deprecation-everywhere-4-port
Use deprecation facility everywhere - v4 port
2019-04-17 17:12:24 -04:00
Clinton Wolfe
7aeb1763a9
Merge pull request #3897 from mattlqx/interface-addresses
Support address matchers on interface resource
2019-04-17 11:57:29 -04:00
Clinton Wolfe
1552dc0210 Merge branch 'cw/use-deprecation-everywhere-3-port' of github.com:inspec/inspec into cw/use-deprecation-everywhere-4-port 2019-04-16 17:42:45 -04:00
Clinton Wolfe
a3a2699e8d Update unit tests to expect deprecations
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-16 17:28:39 -04:00
Clinton Wolfe
0c884b1415
Merge pull request #3895 from mitre/al-mitre/more-permissive-than
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-04-16 14:41:43 -04:00
Matt Kulka
633cea6673 support address matchers on interface resource
Adds missing functionality to `interface`. Fixes #1830

```
describe interface("eth0") do
  its(ipv4_addresses) { should include 1.2.3.4 }
end
```

And so on... see diff/docs for additional matchers.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2019-04-12 08:24:13 -07:00
Jerry Aldrich
40031a9b83 Use deprecation facility throughout code
This converts all current deprecation warnings/TODOs to use the
`Inspec.deprecate()` deprecation facility.

This also modifies `Inspec.deprecate()` to only require 1 argument.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-04-11 19:15:01 -04:00
Stuart Paterson
97f6f232c8
Replace single-quoted static string.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
2019-03-21 16:24:10 +00:00
Stuart Paterson
5accfa5391
Add protection for crontab resource path and document it.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
2019-03-21 15:49:00 +00:00
Aaron Lippold
a2a86860d6 This adds the more_permissive_than?(mode) matcher to the file resource.
Fixes #3893

Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-03-18 18:10:13 -04:00
Keith Walters
c2bd0616fe Allow http resource to follow redirects
By specifying a `max_redirects` attribute, the `http` resource worker
will follow any HTTP Redirect response (301, 302, etc...) up to the
limit defined by this attribute. For a local worker, exceeding that
limit will raise a `FaradayMiddleware::RedirectLimitReached` exception.
For a remote worker, the curl command will exit without populating the
`status` and `body` properties.

Signed-off-by: Keith Walters <keith.walters@cattywamp.us>
2019-03-16 20:54:52 -04:00
Clinton Wolfe
f7d58ad92c Replace most mentions of attribute with input in test/
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
02cb799ee6 Rename free to free_kb
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
5bbd4c16d6 Add size_kb, and correct Powershell code to return KB for both total size and free space, rather than total in GB and free space in bytes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00