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

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

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

activerecord_version, benchmark, chuser, classproxy, #execfail, #execpipe, execute, logmethods, memory, proxy, recmkdir, secure_open, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, 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/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/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/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/puppet/provider/confine/exists.rb', line 16

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