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



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.

API:

  • private



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.

API:

  • private



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:

API:

  • private



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.

API:

  • private



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:

API:

  • private



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.

API:

  • private



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:

API:

  • private



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:

API:

  • private



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

def user?
  name == :user
end