Class: Puppet::Util::RunMode Private

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

Overview

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.

API:

  • private

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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:

API:

  • private



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

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.

API:

  • private



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

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:

API:

  • private



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

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.

API:

  • private



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

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:

API:

  • private



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

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:

API:

  • private



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

def user?
  name == :user
end