Class: Y2Network::Dialogs::S390DeviceActivation

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/y2network/dialogs/s390_device_activation.rb

Overview

Base class dialog for activating S390 devices

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(activator) ⇒ S390DeviceActivation

Constructor


60
61
62
63
64
65
66
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 60

def initialize(activator)
  textdomain "network"

  @activator = activator
  @activator.propose!
  @builder = activator.builder
end

Instance Attribute Details

#activatorObject (readonly)

Returns the value of attribute activator


55
56
57
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 55

def activator
  @activator
end

#builderObject (readonly)

Returns the value of attribute builder


54
55
56
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 54

def builder
  @builder
end

Class Method Details

.for(builder) ⇒ S390DeviceActivation?


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 31

def self.for(builder)
  return nil unless builder.type
  case builder.type.short_name
  # Both interfaces uses the qeth driver and uses the same configuration
  # for activating the group device.
  when "qeth", "hsi"
    require "y2network/dialogs/s390_qeth_activation"
    require "y2network/s390_device_activators/qeth"
    activator = S390DeviceActivators::Qeth.new(builder)
    Y2Network::Dialogs::S390QethActivation.new(activator)
  when "ctc"
    require "y2network/dialogs/s390_ctc_activation"
    require "y2network/s390_device_activators/ctc"
    activator = S390DeviceActivators::Ctc.new(builder)
    Y2Network::Dialogs::S390CtcActivation.new(activator)
  when "lcs"
    require "y2network/dialogs/s390_lcs_activation"
    require "y2network/s390_device_activators/lcs"
    activator = S390DeviceActivators::Lcs.new(builder)
    Y2Network::Dialogs::S390LcsActivation.new(activator)
  end
end

Instance Method Details

#abort_handlerObject


99
100
101
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 99

def abort_handler
  Yast::Popup.ReallyAbort(true)
end

#contentsObject


72
73
74
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 72

def contents
  Empty()
end

#runObject


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 76

def run
  ret = super
  if ret == :next
    configured = activator.configure
    builder.name = activator.configured_interface if configured
    # TODO: Refresh the list of interfaces in yast_config. Take into
    # account that the interface in yast_config does not have a name so
    # the builder.interface is probably nil and should be obtained
    # through the busid.
    if !configured || builder.name.empty?
      Yast::Popup.Error(
        _(
          "An error occurred while creating device.\nSee YaST log for details."
        )
      )

      ret = nil
    end
  end

  ret
end

#titleObject


68
69
70
# File 'src/lib/y2network/dialogs/s390_device_activation.rb', line 68

def title
  _("S/390 Network Card Configuration")
end