Class: Puppet::Provider::Confine::Exists

Inherits:
Puppet::Provider::Confine show all
Defined in:
lib/vendor/puppet/provider/confine/exists.rb

Constant Summary

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows

Instance Attribute Summary

Attributes inherited from Puppet::Provider::Confine

#for_binary, #label, #values

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Puppet::Provider::Confine

#for_binary?, inherited, #initialize, #reset, #result, test, #valid?

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Constructor Details

This class inherits a constructor from Puppet::Provider::Confine

Class Method Details

.summarize(confines) ⇒ Object



4
5
6
# File 'lib/vendor/puppet/provider/confine/exists.rb', line 4

def self.summarize(confines)
  confines.inject([]) { |total, confine| total + confine.summary }
end

Instance Method Details

#message(value) ⇒ Object



12
13
14
# File 'lib/vendor/puppet/provider/confine/exists.rb', line 12

def message(value)
  "file #{value} does not exist"
end

#pass?(value) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/vendor/puppet/provider/confine/exists.rb', line 8

def pass?(value)
  value && (for_binary? ? which(value) : FileTest.exist?(value))
end

#summaryObject



16
17
18
# File 'lib/vendor/puppet/provider/confine/exists.rb', line 16

def summary
  result.zip(values).inject([]) { |array, args| val, f = args; array << f unless val; array }
end