Train 0.26.1 fixes a bug where missing mocked commands would return
a zero exit code. This resulted in some unit tests failing due to
missing mocked commands.
Signed-off-by: Adam Leff <adam@leff.co>
Bumping InSpec's minor version to 1.33 because a recent PR added
new functionality. Also bumping train to 0.26 to pick up a recent
bug fix.
Signed-off-by: Adam Leff <adam@leff.co>
* New matcher 'be_in'
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* small fixes to wording.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* Added code to use be_in for with the following use case:
describe nginx do
its(module_list) { should be_in AUTHORIZED_MODULE_LIST }
end
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Updates to the matcher
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Added tests for the be_in matcher
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Requested updates completed
Signed-off-by: Rony Xavier <rx294@nyu.edu>
In the event we have a docs-only change or similar which does not necessitate a
version bump, changelog update, or omnibus build, a single label named
`Expeditor: Skip All` can be used rather than adding individual labels.
Signed-off-by: Adam Leff <adam@leff.co>
Version bumping and changelog generation has been moved to
Chef's expeditor tool. The github_changelog_generator bits
and the Rake tasks that use them are no longer necessary.
Also, the old historical changelog has been merged back into
the main CHANGELOG.md file since Expeditor does not alter
any existing changelog content like github_changelog_generator
does, so it's safe to bring this stuff back.
Signed-off-by: Adam Leff <adam@leff.co>
The fix is already provided here: https://github.com/chef/inspec/pull/2040
This PR only adds a unit test to catch it
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Add a newline symbol to the end of the parsed input.
Sample hexdump of a file deployed by xinetd cookbook:
$ hexdump -C /var/chef/cache/cookbooks/xinetd/templates/default/xinetd.conf.erb | tail -2
000000b0 72 20 2f 65 74 63 2f 78 69 6e 65 74 64 2e 64 |r /etc/xinetd.d|
000000bf
Signed-off-by: Simonas Kareiva <simonas@5grupe.lt>
With this configuration change, expeditor will add a "latest stable"
section to the changelog automatically whenever we promote InSpec
to the stable channel. All existing changelog entries will remain,
and any additional changelog entries that have been made in newer
versions that are newer than the artifact being promoted will
remain intact.
Signed-off-by: Adam Leff <adam@leff.co>
* bugfix: empty file strings from archive readers
Empty files in archives are sometimes possible (we just ran into this with TGZ), but is never a valid file to extract. So remove it and discount it altogether. Changed structure to support testing of these global calls.
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
* lint and rebuild
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This change updates this repo to begin using the following standard
behavior from Expeditor following a merge to the master branch:
* Automatically bump the `PATCH` version in the `VERSION` file (see https://git.io/vQQYR)
* Create a git tag for the new version (see https://git.io/vQQYR)
* Trigger a release build on manhattan.ci.chef.co using the new tag (see https://git.io/vQQY1)
* Automatically update CHANGELOG (coming soon...the `built_in:update_changelog` merge action is in development)
More details on Expeditor can be found at:
https://github.com/chef/es-lita/tree/master/lita-expeditor
Signed-off-by: Seth Chisamore <schisamo@chef.io>
This reverts commit b803194abd.
Reverting this as we are investigating using an EV cert which has
instant reputation with Microsoft Smartscreen filter.
Signed-off-by: Seth Chisamore <schisamo@chef.io>
If a profile has a data files directory that looks like this:
```
files/platforms/one/data.json
files/platforms/two/data.json
files/platforms/three/data.json
```
... the source reader will return the directories in the list of files but with
nil contents. This causes an issue when Inspec::Profile tries to create a sha256
checksum of the profile contents only to try to cast nil to a string when
building the null-delimited profile contents string.
Files that are empty will have an empty string as its contents, so it's safe to
assume that file entries with nil contents are actually a directory and have no
affect on the profile's checksum. Therefore, this change will eliminate any file
entries in responses from the source readers where the contents are nil.
Signed-off-by: Adam Leff <adam@leff.co>
* Change host resource to use getent ahosts on Linux
In InSpec 1.31, we changed the `host` resource to use `dig` instead of `getent
hosts` for name resolution because `getent hosts` does not return all entries
(only the first v6 entry if it exists, then the first v4 entry) and we wanted to
keep the Darwin and Linux implementation as close as possible. Unfortunately,
this affected users' ability to do resolution checks for entried stored in their
/etc/hosts file.
This change goes back to using `getent` for Linux and changes to `getent ahosts`
which returns both v4 and v6 records. Additionally, the Darwin provider's dig
implementation was reordered to return v4 addresses before v6 addresses to be
consistent with how `getent ahosts` returns records.
Signed-off-by: Adam Leff <adam@leff.co>
* Update unit tests for resolve_with_getent with proper output
Signed-off-by: Adam Leff <adam@leff.co>
`pkg` commands in Habitat 0.25 now use channels and prefer the `stable` channel by
default. However, artifacts uploaded with `hab pkg upload` go to `unstable` by
default (as it should).
This change ensures that `chef/inspec` artifacts land in `stable` during our
release process.
Signed-off-by: Adam Leff <adam@leff.co>
The logic used to determine whether a viable netcat binary exists is wrong and
prevents Linux hosts from doing TCP reachability checks.
Signed-off-by: Adam Leff <adam@leff.co>
* Fix formatter when two profiles have the same name
In the event that an InSpec runner has two profiles that are named the same
(such as when InSpec generates a profile for the Flat source reader, and Test
Kitchen is running concurrently), InSpec could hand back a profile that does not
contain the example. This leads to nil control data and ugly NilClass errors
when TK runs concurrently.
This change modifies the method that finds the profile by control to not only
match on profile name but also match on example ID.
Signed-off-by: Adam Leff <adam@leff.co>
CoreOS is considered a member of the Linux family, and the `host` resource tries
to use `nc` on Linux hosts to test TCP reachability. Unfortunately, `nc` is not
available on CoreOS, but `ncat` is.
This change attempts to use `nc` first, then `ncat` if it's available.
Signed-off-by: Adam Leff <adam@leff.co>
Since Google Custom Search is EOL-ing, we are replacing it with
Swiftype. This adds the necessary markup and JS to make that happen,
as well as some CSS overrides to make it fit with the styling on
the site.
Signed-off-by: Maggie Walker <magwalk@gmail.com>
* Fix host resolution on Darwin, use dig wherever possible
The `host` and `dig` commands do not return non-zero if a query returns NXDOMAIN
or NOERROR, but the DarwinHostProvider was expecting it when deciding whether to
fall back to IPv4 if a IPv6 query failed. Therefore, the `host` resource would
not function properly when resolving hostnames on Darwin. The logic has been
changed to use `dig` short output and query for both v6 and v4 addresses.
Additionally, the LinuxHostProvider has been modified to prefer `dig` if it's
available to keep behavior similar between Darwin and Linux whenever possible.
This has the added benefit of providing v6 and v4 resolution if possible where
`getent hosts` only returns v6 if v6 records exist.
Signed-off-by: Adam Leff <adam@leff.co>
* Fix up methods, add command mock, do string matching in ruby instead of command
Fixes#1643Fixes#1673
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* fixed a small courner case in the error detection - error: vs error
fixed resource to use 'shellwords' module to escape the query
requested chances in method architecture for testing
added unit tests
Fixes: #1814
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* updated resource and tests with requested review changes
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* removed unneeded call to `escaped_query` in the `create_sql_cmd`.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* removed license info
Signed-off-by: Aaron Lippold <lippold@gmail.com>