Class: Puppet::Confine::Any

Inherits:
Puppet::Confine show all
Defined in:
lib/puppet/confine/any.rb

Constant Summary

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE

Constants included from Util::POSIX

Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS

Constants included from Util::SymbolicFileMode

Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit

Instance Attribute Summary

Attributes inherited from Puppet::Confine

#for_binary, #label, #values

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Puppet::Confine

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

Methods included from Util

absolute_path?, benchmark, chuser, clear_environment, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, safe_posix_fork, set_env, symbolizehash, thinmark, uri_encode, uri_query_encode, uri_to_path, which, withenv, withumask

Methods included from Util::POSIX

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

Methods included from Util::SymbolicFileMode

#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Constructor Details

This class inherits a constructor from Puppet::Confine

Class Method Details

.summarize(confines) ⇒ Object



2
3
4
# File 'lib/puppet/confine/any.rb', line 2

def self.summarize(confines)
  confines.inject(0) { |count, confine| count + confine.summary }
end

Instance Method Details

#message(value) ⇒ Object



10
11
12
# File 'lib/puppet/confine/any.rb', line 10

def message(value)
  "0 confines (of #{value.length}) were true"
end

#pass?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/puppet/confine/any.rb', line 6

def pass?(value)
  !! value
end

#summaryObject



14
15
16
# File 'lib/puppet/confine/any.rb', line 14

def summary
  result.find_all { |v| v == true }.length
end

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'lib/puppet/confine/any.rb', line 18

def valid?
  if @values.any? { |value| pass?(value) }
    true
  else
    Puppet.debug("#{label}: #{message(@values)}")
    false
  end
end