Deprecation: Launchd hash Property (CHEF-12)

[edit on GitHub]

The launchd resource has a property called hash which conflicts with the already-existing Ruby hash method that exists on every object.

The CHEF-11 deprecation warns whenever a resource property is named the same as an existing Ruby method. Chef’s core launchd resource is guilty of this behavior. The hash property accepts a Ruby Hash containing the data to be output to the launchd property list. However, hash is an already-existing Ruby method.

A deprecation warning is logged when the hash property is used. In Chef Client 13, this will raise an exception and your Chef run will fail.

The Cookstyle cop ChefDeprecations/LaunchdDeprecatedHashProperty has been introduced to detect and autocorrect this deprecation.

Remediation

When using the launchd resource and passing a hash for the launchd property list, use the plist_hash property instead of the hash property.

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/deprecations_launchd_hash_property/