I just want to do delete directory if it is not symlnik.
directory "/var/www/html/" do
action :delete
only_if ???
end
The selected answer will not work on Windows or systems where Bash is the default interpreter. You should use a Ruby solution to be cross-platform (and faster, since there's no process spawning):
directory '/var/www/html' do
action :delete
not_if { File.symlink?('/var/www/html') }
end
How about:
directory "/var/www/html/" do
action :delete
not_if "test -L /var/www/html/"
end
test -L $file
returns 0 (true) if $file
is a symlink.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With