Chef 12 Only Execute If File Doesn't Exist

I’m installing a rails application that uses Passenger and Apaache(httpd). I don’t want to compile the module if it’s already installed. Unfortunately the not_if option on execute isn’t working and I’m not sure why. The file is definitely there. Is there a better way of accomplishing this and/or troubleshooting this?

Here’s the code in my recipe:

if node[‘app’][‘ruby_version’] == "2.3.3"
gembinary = "/usr/bin/gem"
passengerdir = '/usr’
passengerso = "/usr/lib64/ruby/gems/2.3.0/gems/passenger-#{node[‘passenger’][‘package’][‘version’]}/libout/apache2/"
gembinary = "/opt/ruby-#{node[:app][:ruby_version]}/bin/gem"
passengerdir = "/opt/ruby-#{node[:app][:ruby_version]}"
passengerso = "#{passengerdir}/lib/ruby/gems/#{node[:app][:rubygems_version]}/gems/passenger-#{node[‘passenger’][‘package’][‘version’]}/libout/apache2/"

execute “#{passengerdir}/bin/passenger-install-apache2-module --auto” do
not_if { ::File.exist?(passengerso) }
creates passengerso

The Chef resource for execute definitely has the use of the only_if and not_if as per the first paragraph of the documentation found here.

On windows I use the following for the not_if statement - Single quotes around the path:

not_if { ::File.exists?('C:\path\to\my.file')}

And on linux I would use the following:

not_if { ::File.exists?('/etc/path/to/my.file')}

Hope this helps.

If this is the actual code you are using, it looks like the 2nd 's' is missing on .exists?

not_if { ::File.exists?.....