ruby - Should this Chef recipe be refactored? -


i've written recipe installs windows desktop apps databag:

workstation_apps = data_bag_item('winapps','desktop_apps')  package in workstation_apps['apps']         chocolatey_package "#{package}"         action :install         end end 

running foodcritic error:

fc002: avoid string interpolation not required: ./recipes/default.rb:23 

as can see, added double quotes around #{package} expands variable , not function comment.

is there better way this?

two things: first use of for loops in ruby discouraged in favor of each loops. second, chocolatey package provider support multi-package operations can rewrite recipe this:

workstation_apps = data_bag_item('winapps','desktop_apps') chocolatey_package workstation_apps['apps'] 

(remember :install default action don't need write out)


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -