Commit graph

3574 commits

Author SHA1 Message Date
mr.exz
4647664d56 solve #1569 2017-03-19 00:00:49 +03:00
Adam Leff
ea7c0c493e Provide a method-based accessor for SimpleConfig hashes
When SimpleConfig parses a config file that has sections, such as a mysqld
config file, the values within that section are returned via a Hash. However,
we do not provide an easy way to write tests for those deep hash values:

```
describe mysql_conf('/tmp/my.cnf') do
  its('mysqld.expire_logs_days') { should cmp 10 }
end

  MySQL Configuration
     ∅  undefined method `expire_logs_days' for #<Hash:0x007fe463795a00>
```

This change provides a method-based accessor for Hashes that are built via
SimpleConfig.

```
describe mysql_conf('/tmp/my.cnf') do
  its('mysqld.expire_logs_days') { should cmp 10 }
end

  MySQL Configuration
     ✔  mysqld.expire_logs_days should cmp == 10
```

Fixes #1541 by changing the way the attributes are fetched.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-15 14:49:16 -05:00
Adam Leff
bf36c0a7a7 Merge pull request #1555 from nvtkaszpir/patch-1
Update file.md with example how to test symlinked files
2017-03-15 09:00:32 -05:00
Christoph Hartmann
56986d1bdb Merge pull request #1561 from chef/adamleff/fix-object-traverser-for-arrays
Fix ObjectTraverser when accessing array values
2017-03-15 11:41:27 +01:00
Adam Leff
4f2b66302d Fix ObjectTraverser when accessing array values
When attempting to access array values via the `json` resource:

```
describe json('/tmp/test.json') do
      its(['array',0]) { should eq "zero" }
end
```

... the resulting data would be an array of the size of the original array
with all the values replaced with nils:

```
     expected: "zero"
          got: [nil, nil, nil]
```

This was due to a bug in the ObjectTraverser mixin that mapped array values
back through `extract_value` rather than properly handling the passed-in
key(s). This worked fine for the specific data format created by the `csv`
resource but did not work `json` or any other resource that subclassed the
`JsonConfig` resource.

This change fixes the logic when dealing with an array when it's encountered,
and fixes up the `csv` resource with its own `value` method.

This change also adds tests for ObjectTraverser.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-15 11:35:55 +01:00
Michał Sochoń
7a935a204e Update file.md with example how to test symlinked files.
Added detailed example why and how.
Updated with suggestions from Adam Leff.

Signed-off-by: Michał Sochoń <kaszpir@gmail.com>
2017-03-15 07:53:14 +01:00
Adam Leff
3d551f977f Merge pull request #1559 from chef/adamleff/add-crontab-example
Add additional example for matching crontab commands
2017-03-14 23:39:07 -05:00
Adam Leff
8155357d0a Add additional example for matching crontab commands
As raised in #1526, adding an additional example showing how
a user can use the `where` accessor to find commands matching
a pattern and write a test using the results.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-14 22:16:39 +01:00
Adam Leff
ab9e258112 Merge pull request #1563 from chef/HM-HideCancelledEvent
Hide Event Feature on Homepage
2017-03-14 15:24:19 -05:00
hannah-radish
1f49a9c21e Hide Event Feature on Homepage
Darn that snowstorm. Event is cancelled!

Signed-off-by: hannah-radish <hmaddy@chef.io>
2017-03-14 13:22:24 -07:00
Carl Johnston
30b4152dd2 Add integration tests for symlinked apache configuration.
Remove httpd helper cookbook and write out simple configuration by hand.

Signed-off-by: Carl Johnston <carldjohnston@gmail.com>
2017-03-14 14:48:19 +11:00
Adam Leff
546486ff6a Merge pull request #1550 from chef/chris-rock/upstart-fallback
try to use sysv fallback if is not producing proper output
2017-03-09 17:25:29 -05:00
Adam Leff
1c87db9e7a Merge pull request #1552 from chef/adamleff/better-inspec-yml-errors
Provide better error message when inspec.yml is invalid
2017-03-09 12:34:18 -05:00
Adam Leff
dfce561276 Provide better error message when inspec.yml is invalid
Currently, if the inspec.yml for a profile is invalid (such as including
an improperly-defined multi-line string), InSpec will throw an exception
from the YAML parser that does not given a clear indication that the
issue was encountered while parsing the inspec.yml file.

This change introduces a better exception message to clue the user into
where the problem actually lies.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-09 18:03:01 +01:00
Adam Leff
7667c9cb0a Merge pull request #1525 from spiffytech/patch-1
windows_task docs: Correct syntax error and misspelled word
2017-03-08 15:03:15 -07:00
Adam Leff
8d21366e41 Merge pull request #1536 from tescalada/patch-1
Fixing a typo
2017-03-08 15:02:28 -07:00
Christoph Hartmann
8b1619b60e try to use sysv fallback if is not producing proper output
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-08 21:52:52 +01:00
Adam Leff
71ee19ad3b Merge pull request #1548 from chef/chris-rock/installation
update readme for install scripts
2017-03-07 11:32:41 -07:00
Christoph Hartmann
7437a2b00f update readme for install scripts
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-07 19:25:25 +01:00
Christoph Hartmann
6f2ec9b821 Merge pull request #1547 from chef/adamleff/fix-ipv4-address-as-tcp6-entries
Fixing port check with v4 IPs in a v6 netstat line
2017-03-07 10:08:43 +01:00
Adam Leff
037f08beb2 Fixing port check with v4 IPs in a v6 netstat line
On Linux, netstat may show a tcp6/udp6 protocol line but include a
v4 address. This happens with AF_INET6 sockets that can accept
both v4 and v6 traffic. The port check was not properly handling
this situation and trying to pass a v4 address to URI bracketed as
if it was a v6 address.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-06 22:03:41 -07:00
Christoph Hartmann
ff91244186 Merge pull request #1540 from chef/1.16.1
releasing 1.16.1 with a bug fix and omnibus fix
2017-03-06 19:58:12 +01:00
Adam Leff
45f242e122 releasing 1.16.1 with a bug fix and omnibus fix
Signed-off-by: Adam Leff <adam@leff.co>
2017-03-06 11:58:00 -07:00
Christoph Hartmann
ef775e61c4 Merge pull request #1539 from chef/adamleff/omnibus-build-fix
Fix omnibus build after new JUnit formatter
2017-03-06 19:32:43 +01:00
Adam Leff
9581fda2d8 Fix omnibus build after new JUnit formatter
The new JUnit formatter requires nokogiri, so we need
to build nokogiri via omnibus to ensure liblzma, etc.
is built as part of the omnibus package instead of
`gem` picking up a system liblzma, such as on Mac OS X.

Also bumping ruby to 2.3.1 to match ChefDK.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-06 11:25:20 -07:00
Makoto Nozaki
f913b56ffc Avoid connection timeout of "inspec version" (#1538)
* Add open_timeout to NET::HTTP.start call
Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com>

* Code cleanup based on the discussion at #1538
Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com>
2017-03-06 09:23:42 -07:00
Adam Leff
66dce387ee Merge pull request #1512 from chef/HM-BugFixesWeb-022317
Ready for review - inspec.io bug fixes, #1440, #1420, #1465, #1421, #1437,#1226, #1494, #1495
2017-03-05 18:27:02 -05:00
hannah-radish
74a2a37a5a Updated Tutorial URL in Docs
Signed-off-by: Hannah Maddy <hmaddy@chef.io>
2017-03-03 17:51:20 -08:00
hannah-radish
23434f3606 Bug fixes for Inspec.io
- Added banner for webinars (present and future)
- CSS support for IE10, IE11, Edge
- Fixed URL bug for demo
- Fixed Edge browser resize bug
- Changes to relative path, update event info

Signed-off-by: Hannah Maddy <hmaddy@chef.io>
2017-03-03 12:25:33 -08:00
Tristan Escalada
27d94c5037 Fixing a typo
changing paht to be path.
2017-03-03 14:03:54 -05:00
Adam Leff
408a5c956a Merge pull request #1531 from chef/adamleff/gitignore
Updating .gitignore for Habitat and direnv
2017-03-03 11:09:11 -05:00
Adam Leff
bf2998faf6 Merge pull request #1533 from chef/adamleff/write-output-to-habitat-var
Write Habitat-driven InSpec output to svc_var directory
2017-03-03 11:08:50 -05:00
Adam Leff
9550137605 Write Habitat-driven InSpec output to svc_var directory
When running a InSpec profile built with Habitat, we now
write the formatter/reporter data to a JSON file in the
pkg.svc_var_path rather than STDOUT. This will allow for
programmatic collection of this data and future enhancements
to allow this data to be passed around a Habitat ring.

This also corrects an issue creating a Habitat profile if the
profile had never been in the local InSpec cache. By setting a
mock Backend when creating the profile object, similarly to what
the archivers do, this issue is avoided.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-02 17:45:16 -05:00
Adam Leff
a98af30b45 Updating .gitignore for Habitat and direnv
For direnv users, excluding the .direnv and .envrc entries will
help avoid any unnecessary local environment settings from getting
committed.

Excluding the results directory will avoid any Habitat artifacts
from getting unnecessarily committed.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-02 16:45:37 -05:00
Adam Leff
7154b6b95f Merge pull request #1530 from chef/1.16.0
1.16.0
2017-03-02 15:39:34 -05:00
Adam Leff
14d6678c82 1.16.0
Signed-off-by: Adam Leff <adam@leff.co>
2017-03-02 15:17:55 -05:00
Adam Leff
6bd66df014 Merge pull request #1511 from carldjohnston/oracle-linux-service-resource
Added oracle linux to rhel platform section of 'service' resource.
2017-03-02 07:00:56 -05:00
Alex Pop
8dd5043efb Merge pull request #1527 from chef/chris-rock/compliance-plugin-typo
use -- for description of inspec login_automate
2017-03-02 11:42:24 +00:00
Alex Pop
9c5744338c Merge pull request #1524 from chef/chris-rock/cmp-matcher-docs
fix ident in cmp matcher docs
2017-03-02 11:40:30 +00:00
Christoph Hartmann
71cc62c757 use -- for description of inspec login_automate
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-02 12:30:33 +01:00
Christoph Hartmann
e8e34c2ffe fix ident in cmp matcher docs
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-02 12:28:50 +01:00
Carl Johnston
316c994cc5 Added oracle linux to rhel platform section.
Broken when chef/train was fixed to detect oracle linux correctly.

Signed-off-by: Carl Johnston <carldjohnston@gmail.com>
2017-03-02 22:07:16 +11:00
Christoph Hartmann
be529dcea6 Merge pull request #1513 from postgred/kernel_module_centos
Fix kernel_module for centos/redhat
2017-03-02 09:27:10 +01:00
spiffytech
152f056335 windows_task docs: Correct syntax error and misspelled word 2017-03-01 13:43:26 -05:00
Adam Leff
f4b1a350ce Merge pull request #1501 from jbenden/jbenden/freebsd-zfs
Add FreeBSD support for ZFS datasets and pools
2017-03-01 13:06:44 -05:00
Christoph Hartmann
81c9368941 Merge pull request #1520 from chef/adamleff/fix-habitat-build
Add Rake to Habitat build Gemfile
2017-03-01 19:03:16 +01:00
Adam Leff
3e0369046e Add Rake to Habitat build Gemfile
The `rainbow` gem requires `rake` to build native extensions, and rake
is a development dependency for InSpec, not a runtime dependency.

This change adds the `rake` gem to the Habitat build Gemfile so we
can successfully build a Habitat artifact.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-01 18:10:53 +01:00
Adam Leff
19f114deea Merge pull request #1454 from jkerry/FunctionalJUnitReporter
Functional JUnit reporter
2017-02-27 12:00:36 -05:00
Adam Leff
d3f7de3134 Merge pull request #1519 from chef/v1.15.0
1.15.0
2017-02-27 11:29:44 -05:00
Adam Leff
1485debdde 1.15.0
Signed-off-by: Adam Leff <adam@leff.co>
2017-02-27 11:21:39 -05:00