Skip to content

Commit

Permalink
Merge pull request #745 from yast/network-ng-yast-lan-config-api
Browse files Browse the repository at this point in the history
Add an API to access configurations through Yast::Lan
  • Loading branch information
imobachgs committed Mar 26, 2019
2 parents a3f3a1a + fe916d5 commit 51821f1
Show file tree
Hide file tree
Showing 2 changed files with 441 additions and 367 deletions.
26 changes: 26 additions & 0 deletions src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def main
@initialized = false

@backend = nil

# Y2Network::Config objects
@configs = []
end

#------------------
Expand Down Expand Up @@ -961,6 +964,26 @@ def dhcp_ntp_servers
Yast::LanItems.dhcp_ntp_servers.values.flatten.uniq
end

# Returns the network configuration with the given ID
#
# @param id [Symbol] Network configuration ID
# @return [Y2Network::Config,nil] Network configuration with the given ID or nil if not found
def find_config(id: :system)
configs.find { |c| c.id == id }
end

# Adds the configuration
#
# @param config [Y2Network::Config] Network configuration
def add_config(config)
configs << config
end

# Clears the network configurations list
def clear_configs
configs.clear
end

publish variable: :ipv6, type: "boolean"
publish variable: :AbortFunction, type: "block <boolean>"
publish variable: :bond_autoconf_slaves, type: "list <string>"
Expand All @@ -985,6 +1008,9 @@ def dhcp_ntp_servers

private

# @return [Array<Y2Network::Config>]
attr_reader :configs

def activate_network_service
# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network because systemctl
Expand Down
Loading

0 comments on commit 51821f1

Please sign in to comment.