Skip to content

Commit

Permalink
Added a parameter which indicates if the udev rules should be applied
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 20, 2020
1 parent 52fccdb commit fdfc7ae
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/y2network/sysconfig/interfaces_writer.rb
Expand Up @@ -34,6 +34,10 @@ module Sysconfig
#
# @see Y2Network::InterfacesCollection
class InterfacesWriter
def initialize(reload: true)
@reload = reload
end

# Writes interfaces hardware configuration and refreshes udev
#
# @param interfaces [Y2Network::InterfacesCollection] Interfaces collection
Expand All @@ -44,6 +48,10 @@ def write(interfaces)

private

def reload?
@reload
end

# Creates an udev rule to set the driver for the given interface
#
# @param iface [Interface] Interface to generate the udev rule for
Expand All @@ -60,7 +68,7 @@ def driver_udev_rule_for(iface)
def update_udevd(interfaces)
update_renaming_udev_rules(interfaces)
update_drivers_udev_rules(interfaces)
reload_udev_rules
reload_udev_rules if reload?
end

# Writes down the current interfaces udev rules and the custom rules that
Expand Down Expand Up @@ -105,7 +113,7 @@ def shut_down_old_interfaces(interfaces)
#
# @param iface_name [String] Interface's name
def shut_down_interface(iface_name)
Yast::Execute.on_target("/sbin/ifdown", iface_name) unless Yast::Mode.autoinst
Yast::Execute.on_target("/sbin/ifdown", iface_name) if reload?
end
end
end
Expand Down

0 comments on commit fdfc7ae

Please sign in to comment.