Class: Y2Network::Clients::Auto

Inherits:
Installation::AutoClient
  • Object
show all
Defined in:
src/lib/y2network/clients/auto.rb

Overview

This class is responsible of AutoYaST network configuration

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAuto

Constructor



30
31
32
33
34
35
# File 'src/lib/y2network/clients/auto.rb', line 30

def initialize
  super
  textdomain "network"

  Yast.include self, "network/lan/wizards.rb"
end

Class Attribute Details

.modifiedObject

Returns the value of attribute modified.



109
110
111
# File 'src/lib/y2network/clients/auto.rb', line 109

def modified
  @modified
end

Instance Method Details

#changeObject



71
72
73
74
75
76
# File 'src/lib/y2network/clients/auto.rb', line 71

def change
  if !Yast::Lan.yast_config
    Yast::Lan.add_config(:yast, Y2Network::Config.new(:source, :config))
  end
  LanAutoSequence("")
end

#exportObject



112
113
114
115
116
# File 'src/lib/y2network/clients/auto.rb', line 112

def export
  raw_config = Yast::Lan.Export
  log.debug("settings: #{raw_config.inspect}")
  adapt_for_autoyast(raw_config)
end

#import(profile) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'src/lib/y2network/clients/auto.rb', line 78

def import(profile)
  Yast::NetworkAutoYast.instance.ay_networking_section = profile

  modified_profile = Yast::Lan.FromAY(profile)

  # see bnc#498993
  # in case keep_install_network is set to true (in AY)
  # we'll keep values from installation
  # and merge with XML data (bnc#712864)
  if modified_profile.fetch("keep_install_network", true)
    modified_profile = Yast::NetworkAutoYast.instance.merge_configs(modified_profile)
  end

  Yast::Lan.Import(modified_profile)

  true
end

#modifiedObject



100
101
102
# File 'src/lib/y2network/clients/auto.rb', line 100

def modified
  self.class.modified = true
end

#modified?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'src/lib/y2network/clients/auto.rb', line 104

def modified?
  !!self.class.modified
end

#packagesObject



96
97
98
# File 'src/lib/y2network/clients/auto.rb', line 96

def packages
  Yast::Lan.AutoPackages
end

#readObject



37
38
39
40
41
42
# File 'src/lib/y2network/clients/auto.rb', line 37

def read
  @progress_orig = Yast::Progress.set(false)
  ret = Yast::Lan.Read(:nocache)
  Yast::Progress.set(@progress_orig)
  ret
end

#resetObject



65
66
67
68
69
# File 'src/lib/y2network/clients/auto.rb', line 65

def reset
  Yast::Lan.Import({})
  Yast::Lan.clear_configs
  {}
end

#summaryObject



61
62
63
# File 'src/lib/y2network/clients/auto.rb', line 61

def summary
  Yast::Lan.Summary("summary")
end

#writeObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'src/lib/y2network/clients/auto.rb', line 44

def write
  @progress_orig = Yast::Progress.set(false)

  result = Yast::Lan.WriteOnly
  log.error("Writing lan config failed") if !result
  @ret &&= result
  timeout = Yast::Lan.autoinst.ip_check_timeout || -1

  if (timeout >= 0) && Lan.isAnyInterfaceDown
    Builtins.y2debug("timeout %1", timeout)
    error_text = _("Configuration Error: uninitialized interface.")
    (timeout == 0) ? Popup.Error(error_text) : Popup.TimedError(error_text, timeout)
  end

  Yast::Progress.set(@progress_orig)
end