Module: DopCommon::Node::Config

Included in:
DopCommon::Node
Defined in:
lib/dop_common/node/config.rb

Constant Summary collapse

@@mutex_hiera =
Mutex.new
@@mutex_lookup =
Mutex.new
@@hiera =
nil
@@hiera_config =
nil

Instance Method Summary collapse

Instance Method Details

#config(variable) ⇒ Object



17
18
19
# File 'lib/dop_common/node/config.rb', line 17

def config(variable)
  resolve_external(variable) || resolve_internal(variable)
end

#config_includes?(variable, pattern) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dop_common/node/config.rb', line 25

def config_includes?(variable, pattern)
  [config(variable)].flatten.any?{|v| pattern_match?(v, pattern)}
end

#fact(variable) ⇒ Object



29
30
31
# File 'lib/dop_common/node/config.rb', line 29

def fact(variable)
  scope[ensure_global_namespace(variable)]
end

#has_config?(variable, pattern) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/dop_common/node/config.rb', line 21

def has_config?(variable, pattern)
  pattern_match?(config(variable), pattern)
end

#has_fact?(variable, pattern) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/dop_common/node/config.rb', line 33

def has_fact?(variable, pattern)
  pattern_match?(fact(variable), pattern)
end

#has_name?(pattern) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/dop_common/node/config.rb', line 13

def has_name?(pattern)
  pattern_match?(name, pattern)
end

#has_role?(pattern) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/dop_common/node/config.rb', line 41

def has_role?(pattern)
  pattern_match?(role, pattern)
end

#roleObject



37
38
39
# File 'lib/dop_common/node/config.rb', line 37

def role
  config(DopCommon.config.role_variable) || role_default
end