Skip to content

Commit

Permalink
Do not remove ifcfg-file before write
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Dec 9, 2020
1 parent 2cee01b commit 22b6d2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/lib/y2network/sysconfig/connection_config_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def write(conn, old_conn = nil)
handler_class = find_handler_class(conn.type)
return nil if handler_class.nil?

remove(old_conn) if old_conn
file.clean
handler_class.new(file).write(conn)
file.save
Expand Down
10 changes: 9 additions & 1 deletion src/lib/y2network/sysconfig/interface_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,16 @@ def type
# to do some clean-up before writing the final values.
def clean
@values = self.class.variables.values.each_with_object({}) do |variable, hash|
hash[variable.name] = variable.collection? ? {} : nil
if variable.collection?
clean_collection(variable.name)
hash[variable.name] = {}
next
end

hash[variable.name] = nil
write_scalar(variable.name, nil)
end

@defined_variables = nil
end

Expand Down

0 comments on commit 22b6d2d

Please sign in to comment.