Deprecation: run_command and popen4 helper method removal (OHAI-3)
Ohai ships a command mixin for use by plugin authors in shelling out to external commands. This mixin originally included run_command
and popen4
methods, which were deprecated in Ohai 8.11.1 (Chef Client 12.8.1) in favor of the more robust mixlib-shellout
gem functionality. In Chef Client 13 these deprecated methods will be removed, breaking any Ohai plugins authored using the deprecated methods.
Remediation
Plugins should be updated to use mixlib-shellout instead of the run_command.
Deprecated run_command based code:
status, stdout, stderr = run_command(command: 'myapp --version')
if status == 0
version = stdout
end
Updated code for mixlib shellout:
so = shell_out('myapp --version')
if so.exitstatus == 0
version = so.stdout
end
See the mixlib-shellout repo for additional usage information.
© 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_ohai_run_command_helpers/