Skip to content

Commit

Permalink
Special handling of empty or nil BOOTPROTO (see wicked docu).bnc#1175206
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Oct 16, 2020
1 parent 856f44e commit dfd6a23
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/lib/y2network/autoinst_profile/interface_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ def init_from_hashes(hash)
# @param config [Y2Network::ConnectionConfig]
# @return [Boolean]
def init_from_config(config)
@bootproto = config.bootproto.name
# nil bootproto is valid use case (missing explicit setup) - wicked defaults to static then
@bootproto = config.bootproto&.name
@name = config.name
if config.bootproto == BootProtocol::STATIC && config.ip
# missing ip is valid scenario for wicked - so use empty string here
Expand Down
2 changes: 1 addition & 1 deletion src/lib/y2network/boot_protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def all
# Returns the boot protocol with a given name
#
# @param name [String]
# @return [BootProtocol,nil] Boot protocol or nil is not found
# @return [BootProtocol,nil] Boot protocol or nil if not found
def from_name(name)
all.find { |t| t.name == name }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def initialize(file)
#
# @param conn [Y2Network::ConnectionConfig::Base] Connection to take settings from
def write(conn)
file.bootproto = conn.bootproto.name
file.bootproto = conn.bootproto&.name
file.name = conn.description
file.lladdr = conn.lladdress
file.startmode = conn.startmode.to_s
Expand Down

0 comments on commit dfd6a23

Please sign in to comment.