From: Tom Hughes Date: Mon, 9 Sep 2019 19:00:53 +0000 (+0100) Subject: Avoid including Chef::Mixin::ShellOut in resources X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/4dcb23986ff3a910b930338201c8cd688bfdb8e9?ds=sidebyside Avoid including Chef::Mixin::ShellOut in resources --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c273a9199..945610536 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -25,14 +25,6 @@ ChefCorrectness/NodeNormalUnless: - 'cookbooks/mediawiki/resources/site.rb' - 'cookbooks/wordpress/resources/site.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: Include. -# Include: **/resources/*.rb, **/providers/*.rb -ChefModernize/IncludingMixinShelloutInResources: - Exclude: - - 'cookbooks/nodejs/resources/package.rb' - # Offense count: 947 # Cop supports --auto-correct. # Configuration parameters: . diff --git a/cookbooks/nodejs/resources/package.rb b/cookbooks/nodejs/resources/package.rb index 23b9414ea..9d30c164f 100644 --- a/cookbooks/nodejs/resources/package.rb +++ b/cookbooks/nodejs/resources/package.rb @@ -17,7 +17,6 @@ # limitations under the License. # -require "chef/mixin/shell_out" require "json" default_action :install @@ -61,8 +60,6 @@ action :remove do end action_class do - include Chef::Mixin::ShellOut - def current_version @current_version ||= JSON.parse(shell_out("npm list --global --json").stdout) .dig("dependencies", new_resource.package, "version")