Class: Y2Network::S390DeviceActivator
- Inherits:
-
Object
- Object
- Y2Network::S390DeviceActivator
- Extended by:
- Forwardable
- Includes:
- Yast::Logger
- Defined in:
- src/lib/y2network/s390_device_activator.rb
Overview
This class is responsable of activating the supported S390 devices.
Direct Known Subclasses
Y2Network::S390DeviceActivators::Ctc, Y2Network::S390DeviceActivators::Qeth
Constant Summary collapse
- CONFIGURE_CMD =
Command for configuring z Systems specific devices
"/sbin/chzdev".freeze
- LIST_CMD =
Command for displaying configuration of z Systems specific devices
"/sbin/lszdev".freeze
Instance Attribute Summary collapse
-
#builder ⇒ Object
Returns the value of attribute builder.
Class Method Summary collapse
-
.for(builder) ⇒ Object
Load fresh instace of device activator for given interface config builder.
Instance Method Summary collapse
-
#configure ⇒ Boolean
It tries to enable the interface with the configured device id.
-
#configure_attributes ⇒ Array<String>
Each s390 device type permits a set of attributes to be passed as extra options to the configuration command.
-
#configured_interface ⇒ String
Obtains the enabled interface name associated with the device id.
-
#initialize(builder) ⇒ S390DeviceActivator
constructor
Constructor.
-
#propose! ⇒ Object
Makes a new configuration proposal.
Constructor Details
#initialize(builder) ⇒ S390DeviceActivator
Constructor
51 52 53 |
# File 'src/lib/y2network/s390_device_activator.rb', line 51 def initialize(builder) @builder = builder end |
Instance Attribute Details
#builder ⇒ Object
Returns the value of attribute builder.
36 37 38 |
# File 'src/lib/y2network/s390_device_activator.rb', line 36 def builder @builder end |
Class Method Details
.for(builder) ⇒ Object
Load fresh instace of device activator for given interface config builder
39 40 41 42 43 44 45 46 |
# File 'src/lib/y2network/s390_device_activator.rb', line 39 def self.for(builder) type = builder.type require "y2network/s390_device_activators/#{type.file_name}" S390DeviceActivators.const_get(type.class_name).new(builder) rescue LoadError => e log.info "Specialized device activator for #{type.short_name} not found. #{e.inspect}" nil end |
Instance Method Details
#configure ⇒ Boolean
It tries to enable the interface with the configured device id
75 76 77 78 79 80 81 82 83 |
# File 'src/lib/y2network/s390_device_activator.rb', line 75 def configure return false unless device_id cmd = [CONFIGURE_CMD, type.short_name, device_id, "-e"].concat(configure_attributes) log.info("Activating s390 device: #{device_id}") Yast::Execute.on_target!(*cmd, stdout: :capture, stderr: :capture, allowed_exitstatus: 0..255) end |
#configure_attributes ⇒ Array<String>
Each s390 device type permits a set of attributes to be passed as extra options to the configuration command. This method return a list of each option in the form "attribute=value"
68 69 70 |
# File 'src/lib/y2network/s390_device_activator.rb', line 68 def configure_attributes [] end |
#configured_interface ⇒ String
Obtains the enabled interface name associated with the device id
88 89 90 91 92 93 94 |
# File 'src/lib/y2network/s390_device_activator.rb', line 88 def configured_interface return "" unless device_id cmd = [LIST_CMD, device_id, "-c", "names", "-n"] Yast::Execute.stdout.on_target!(cmd).chomp end |
#propose! ⇒ Object
Makes a new configuration proposal
97 |
# File 'src/lib/y2network/s390_device_activator.rb', line 97 def propose!; end |