fix unless

This commit is contained in:
John Bintz 2012-05-07 14:30:35 -04:00
parent 246f2164c6
commit d5c3649e6a
3 changed files with 12 additions and 6 deletions

View File

@ -10,7 +10,9 @@ Puppet::Type.type(:configure).provide(:action) do
end end
def exists? def exists?
unless? || File.file?(config_status) return true if unless?
File.file?(config_status)
end end
private private
@ -19,7 +21,7 @@ Puppet::Type.type(:configure).provide(:action) do
end end
def unless? def unless?
return true if @resource[:unless].empty? return nil if @resource[:unless].empty?
system %{bash -c '#{@resource[:unless]}'} system %{bash -c '#{@resource[:unless]}'}
$?.exitstatus == 0 $?.exitstatus == 0

View File

@ -15,12 +15,14 @@ Puppet::Type.type(:download_and_unpack).provide(:action) do
end end
def exists? def exists?
unless? || (File.directory?(File.join(@resource[:src_path], target_dir))) return true if unless?
File.directory?(File.join(@resource[:src_path], target_dir))
end end
private private
def unless? def unless?
return true if @resource[:unless].empty? return nil if @resource[:unless].empty?
system %{bash -c '#{@resource[:unless]}'} system %{bash -c '#{@resource[:unless]}'}

View File

@ -16,12 +16,14 @@ Puppet::Type.type(:make_and_install).provide(:action) do
end end
def exists? def exists?
unless? || (File.directory?(@resource[:install_path]) && File.symlink?(symlink_path)) return true if unless?
File.directory?(@resource[:install_path]) && File.symlink?(symlink_path)
end end
private private
def unless? def unless?
return true if @resource[:unless].empty? return nil if @resource[:unless].empty?
system %{bash -c '#{@resource[:unless]}'} system %{bash -c '#{@resource[:unless]}'}
$?.exitstatus == 0 $?.exitstatus == 0