Class: Puppet::Util::RunMode Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/run_mode.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

UnixRunMode, WindowsRunMode

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ RunMode

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RunMode.


6
7
8
# File 'lib/puppet/util/run_mode.rb', line 6

def initialize(name)
  @name = name.to_sym
end

Instance Attribute Details

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
# File 'lib/puppet/util/run_mode.rb', line 10

def name
  @name
end

Class Method Details

.[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


12
13
14
15
16
17
18
19
# File 'lib/puppet/util/run_mode.rb', line 12

def self.[](name)
  @run_modes ||= {}
  if Puppet::Util::Platform.windows?
    @run_modes[name] ||= WindowsRunMode.new(name)
  else
    @run_modes[name] ||= UnixRunMode.new(name)
  end
end

Instance Method Details

#agent?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

29
30
31
# File 'lib/puppet/util/run_mode.rb', line 29

def agent?
  name == :agent
end

#log_dirObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


41
42
43
# File 'lib/puppet/util/run_mode.rb', line 41

def log_dir
  RunMode[name].log_dir
end

#master?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

25
26
27
# File 'lib/puppet/util/run_mode.rb', line 25

def master?
  name == :master || name == :server
end

#run_dirObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


37
38
39
# File 'lib/puppet/util/run_mode.rb', line 37

def run_dir
  RunMode[name].run_dir
end

#server?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

21
22
23
# File 'lib/puppet/util/run_mode.rb', line 21

def server?
  name == :master || name == :server
end

#user?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

33
34
35
# File 'lib/puppet/util/run_mode.rb', line 33

def user?
  name == :user
end