Class: Y2Network::Autoinst::Config

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/autoinst/config.rb

Overview

This class is responsible of storing network settings that are only relevant to the autoinstallation proccess.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

Constructor

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :before_proposal (Boolean)
  • :start_immediately (Boolean)
  • :keep_install_network (Boolean)
  • :ip_check_timetout (Integer)
  • :virt_bridge_proposal (Boolean)
  • :managed (Boolean)
  • :backend (String, Symbol)


54
55
56
57
58
59
60
61
62
63
64
# File 'src/lib/y2network/autoinst/config.rb', line 54

def initialize(opts = {})
  ay_options = opts.compact

  @before_proposal = ay_options.fetch(:before_proposal, false)
  @start_immediately = ay_options.fetch(:start_immediately, true)
  @keep_install_network = ay_options.fetch(:keep_install_network, true)
  @ip_check_timeout = ay_options.fetch(:ip_check_timeout, -1)
  @virt_bridge_proposal = ay_options.fetch(:virt_bridge_proposal, true)
  @managed              = ay_options[:managed]
  @backend              = ay_options[:backend]&.to_sym
end

Instance Attribute Details

#backendSymbol

Returns backend id.

Returns:

  • (Symbol)

    backend id



42
43
44
# File 'src/lib/y2network/autoinst/config.rb', line 42

def backend
  @backend
end

#before_proposalBoolean

Returns controls whether the network configuration should be run before the proposal.

Returns:

  • (Boolean)

    controls whether the network configuration should be run before the proposal



27
28
29
# File 'src/lib/y2network/autoinst/config.rb', line 27

def before_proposal
  @before_proposal
end

#ip_check_timeoutInteger

Returns:

  • (Integer)


35
36
37
# File 'src/lib/y2network/autoinst/config.rb', line 35

def ip_check_timeout
  @ip_check_timeout
end

#keep_install_networkBoolean

Returns controls whether the configuration done during the installation should be copied to the target system at the end.

Returns:

  • (Boolean)

    controls whether the configuration done during the installation should be copied to the target system at the end



33
34
35
# File 'src/lib/y2network/autoinst/config.rb', line 33

def keep_install_network
  @keep_install_network
end

#managedBoolean

Returns whether the network is managed by NM or not

Returns:

  • (Boolean)

    returns whether the network is managed by NM or not



40
41
42
# File 'src/lib/y2network/autoinst/config.rb', line 40

def managed
  @managed
end

#start_immediatelyBoolean

Returns controls whether the network should be restarted immediately after write or not.

Returns:

  • (Boolean)

    controls whether the network should be restarted immediately after write or not



30
31
32
# File 'src/lib/y2network/autoinst/config.rb', line 30

def start_immediately
  @start_immediately
end

#virt_bridge_proposalBoolean

Returns controls whether a bridge configuration for virtualization network should be proposed or not.

Returns:

  • (Boolean)

    controls whether a bridge configuration for virtualization network should be proposed or not



38
39
40
# File 'src/lib/y2network/autoinst/config.rb', line 38

def virt_bridge_proposal
  @virt_bridge_proposal
end

Instance Method Details

#copy_network?Boolean

Return whether the network should be copied at the end

Returns:

  • (Boolean)


69
70
71
# File 'src/lib/y2network/autoinst/config.rb', line 69

def copy_network?
  keep_install_network || before_proposal
end

#selected_backendSymbol?

Explicitly selected backend according to the AY options given

Returns:

  • (Symbol, nil)


76
77
78
79
80
81
# File 'src/lib/y2network/autoinst/config.rb', line 76

def selected_backend
  return backend.to_sym unless [nil, ""].include?(backend)
  return if managed.nil?

  managed ? :network_manager : :wicked
end