better handling of unless confitions

This commit is contained in:
John Bintz 2012-07-18 18:02:21 -04:00
parent 9d66fe8943
commit 63a75fdb36
3 changed files with 4 additions and 6 deletions

View File

@ -2,10 +2,8 @@ Puppet::Type.type(:configure).provide(:action) do
desc "Configure a program to install" desc "Configure a program to install"
def create def create
command = %{bash -c "env ; sleep 10 ; cd #{@resource[:build_path]} && #{@resource[:preconfigure].gsub('"', '\\"')} #{path} ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}"}.tap { |o| p o } command = %{bash -c "cd #{@resource[:build_path]} && #{@resource[:preconfigure].gsub('"', '\\"')} #{path} ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}"}.tap { |o| p o }
system command system command
p $?
puts command
raise StandardError.new("Could not configure") if $?.exitstatus != 0 raise StandardError.new("Could not configure") if $?.exitstatus != 0
end end
@ -14,7 +12,7 @@ Puppet::Type.type(:configure).provide(:action) do
end end
def exists? def exists?
return true if unless? return unless? if unless? != nil
File.file?(config_status) File.file?(config_status)
end end

View File

@ -15,7 +15,7 @@ Puppet::Type.type(:download_and_unpack).provide(:action) do
end end
def exists? def exists?
return true if unless? return unless? if unless? != nil
File.directory?(File.join(@resource[:src_path], target_dir)) File.directory?(File.join(@resource[:src_path], target_dir))
end end

View File

@ -17,7 +17,7 @@ Puppet::Type.type(:make_and_install).provide(:action) do
end end
def exists? def exists?
return true if unless? return unless? if unless? != nil
File.directory?(@resource[:install_path]) && File.symlink?(symlink_path) File.directory?(@resource[:install_path]) && File.symlink?(symlink_path)
end end