-Dir.glob("/var/cache/chef/osmosis-*.zip").each do |zip|
- if zip != "/var/cache/chef/#{osmosis_package}"
- file zip do
- action :delete
- backup false
- end
+osmosis_version = node[:osmosis][:version]
+osmosis_package = "osmosis-#{osmosis_version}.zip"
+osmosis_directory = "/opt/osmosis-#{osmosis_version}"
+
+Dir.glob("#{cache_dir}/osmosis-*.zip").each do |zip|
+ next if zip == "#{cache_dir}/#{osmosis_package}"
+
+ file zip do
+ action :delete
+ backup false