Module: Y2Remote::Modes

Defined in:
src/lib/y2remote/modes/base.rb,
src/lib/y2remote/modes.rb,
src/lib/y2remote/modes/vnc.rb,
src/lib/y2remote/modes/web.rb,
src/lib/y2remote/modes/manager.rb,
src/lib/y2remote/modes/socket_based.rb

Overview

Class to handle the different remote running modes

Defined Under Namespace

Modules: SocketBased Classes: Base, Manager, VNC, Web

Constant Summary collapse

MODES =
[VNC, Manager, Web].freeze

Class Method Summary collapse

Class Method Details

.allArray<Y2Remote::Modes::Base>

Return a list with all the available Y2Remote::Remote::Base subclases


34
35
36
# File 'src/lib/y2remote/modes.rb', line 34

def self.all
  MODES
end

.restart_modes(enable_modes = []) ⇒ Object

Restart all the given list of Y2Remote::Modes::Base instances and stop the rest.

rest will be stopped


50
51
52
53
54
55
56
# File 'src/lib/y2remote/modes.rb', line 50

def self.restart_modes(enable_modes = [])
  # There are conflicts between modes. Therefore we have to stop first the
  # disabled ones.
  all.each { |mc| mc.instance.stop! unless enable_modes.include?(mc.instance) }

  enable_modes.each(&:restart!)
end

.running_modesArray<Y2Remote::Modes::Base>

Return a list with all the enabled Y2Remote::Modes::Base instances.


41
42
43
# File 'src/lib/y2remote/modes.rb', line 41

def self.running_modes
  all.select { |m| m.instance.enabled? }.map(&:instance)
end

.update_status(enable_modes = []) ⇒ Object

Enable all the given list of Y2Remote::Modes::Base instances and disable the rest.

rest will be disable


63
64
65
66
67
# File 'src/lib/y2remote/modes.rb', line 63

def self.update_status(enable_modes = [])
  all.each do |mode|
    enable_modes.include?(mode.instance) ? mode.instance.enable! : mode.instance.disable!
  end
end