Hey Everyone,
It's time for the weekly Cookstyle release. This update includes an important new cop and some improvements to a few of the existing cops:
ChefDeprecations/DeprecatedChefSpecPlatform
The ChefDeprecations/DeprecatedChefSpecPlatform
cop detects platforms in ChefSpec tests that have been deprecated in the Fauxhai / ChefSpec projects. Specifying deprecated platforms will create errors in ChefSpec because the mock Ohai data cannot be loaded to emulate a full Chef Infra Client run.
Platforms are deprecated from the Fauxhai project from time to time to prevent the Fauxhai package size from becoming too large. To avoid specifying deprecated platforms, use the newer platform matching functionality in ChefSpec. Previously you needed to specify the exact platform release when writing specs, but now ChefSpec will load the latest version if you skip the version number, or you can provide the major release and let ChefSpec do the rest.
Examples
ChefSpec calling a deprecated release of Debian 8:
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'debian', version: '8.2') }
ChefSpec calling the latest minor version of Debian 8 instead:
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'debian', version: '8') }
ChefSpec calling using the latest major.minor version of Debian instead:
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'debian') }
Other fixes and changes
- The
ChefModernize/ExecuteSysctl
cop will now detectexecute
resources that call systctl using the full path to the binary. - The
ChefModernize/LibarchiveFileResource
resource will now replace thelibarchive_file
resource with Chef Infra Client's built-inarchive_file
resource. - The
ChefStyle/UnnecessaryPlatformCaseStatement
cop will no longer attempt to autocorrect empty case statements.
Enjoy,
Tim