Skip to content

Commit

Permalink
Merge branch 'master' into delete_wicked_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Sep 2, 2016
2 parents 32242dd + bb8074f commit 21424b1
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 154 deletions.
26 changes: 14 additions & 12 deletions CONTRIBUTING.md
Expand Up @@ -3,7 +3,7 @@ YaST Contribution Guidelines

YaST is an open source project and as such it welcomes all kinds of
contributions. If you decide to contribute, please follow these guidelines to
ensure the process is effective and pleasant both for you and YaST maintainers.
ensure the process is effective and pleasant both for you and the YaST maintainers.

There are two main forms of contribution: reporting bugs and performing code
changes.
Expand All @@ -17,13 +17,11 @@ or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
if you don't have an account yet.)

If you find a problem, please report it either using
[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee
that every bug will be fixed, but we'll try.

When creating a bug report, please follow our [bug reporting
guidelines](http://en.opensuse.org/openSUSE:Report_a_YaST_bug).

We can't guarantee that every bug will be fixed, but we'll try.

Code Changes
------------

Expand All @@ -44,25 +42,29 @@ follows:
to the [Ruby style
guide](https://github.com/SUSE/style-guides/blob/master/Ruby.md).

4. Make sure your change didn't break anything by building the RPM package
4. Update the package version (in `packages/*.spec`, usually by
`rake version:bump`) and add a new entry to the `package/*.changes` file
(by `osc vc package`).
For bigger changes or changes which need longer discussion it is advised to
add this as a separate last commit so it can be easily updated when another
change is merged in the meantime.

5. Make sure your change didn't break anything by building the RPM package
(`rake osc:build`). The build process includes running the full testsuite.

5. Publish the branch and create a pull request.
6. Publish the branch and create a pull request.

6. YaST developers will review your change and possibly point out issues.
7. YaST developers will review your change and possibly point out issues.
Adapt the code under their guidance until they are all resolved.

7. Finally, the pull request will get merged or rejected.
8. Finally, the pull request will get merged or rejected.

See also [GitHub's guide on
contributing](https://help.github.com/articles/fork-a-repo).

If you want to do multiple unrelated changes, use separate branches and pull
requests.

Do not change the `VERSION` and `*.changes` files as this could lead to
conflicts.

### Commits

Each commit in the pull request should do only one thing, which is clearly
Expand Down
67 changes: 65 additions & 2 deletions package/yast2-network.changes
@@ -1,9 +1,72 @@
-------------------------------------------------------------------
Mon Aug 8 14:40:57 UTC 2016 - kanderssen@suse.com
Mon Sep 2 09:40:57 UTC 2016 - kanderssen@suse.com

- Set the link down by wicked if it is the NetworkService.
(bsc#991694)
- 3.1.161
- 3.1.169

Wed Aug 24 10:54:55 UTC 2016 - mfilka@suse.com

- bnc#993587
- installer is able to newly configured set devices up in case of
ssh/vnc installation
- 3.1.168

-------------------------------------------------------------------
Fri Aug 19 08:59:14 UTC 2016 - mfilka@suse.com

- bnc#991382
- init and store IFPLUGD_PRIORITY properly
- 3.1.167

-------------------------------------------------------------------
Thu Aug 18 08:52:41 UTC 2016 - mfilka@suse.com

- bnc#991486
- extended fix for this bug from 3.1.163. Do not report invalid
names incorrectly
- 3.1.166

-------------------------------------------------------------------
Thu Aug 11 19:02:36 UTC 2016 - mfilka@suse.com

- bnc#985905
- do not limit number of bonding slaves to 10
- 3.1.165

-------------------------------------------------------------------
Thu Aug 11 08:23:00 UTC 2016 - mfilka@suse.com

- bnc#988786
- Create bridge when proposing configuration for VM host.
- 3.1.164

-------------------------------------------------------------------
Wed Aug 10 18:07:12 UTC 2016 - ancor@suse.com

- Improved parsing of vlan ids that are longer than one character.

-------------------------------------------------------------------
Wed Aug 10 16:07:26 UTC 2016 - mfilka@suse.com

- bnc#991486
- Do not allow creating device with oversized configuration name.
- 3.1.163

-------------------------------------------------------------------
Tue Aug 9 12:29:35 UTC 2016 - schubi@suse.de

- Added entry "s390-devices" to the AutoYaST schema file.
Bug similar bnc#954412.
- 3.1.162

-------------------------------------------------------------------
Tue Aug 9 12:25:01 UTC 2016 - mfilka@suse.com

- bnc#991920
- do not crash with internal error when renaming unconfigured
device
- 3.1.161

-------------------------------------------------------------------
Tue Aug 2 12:40:53 UTC 2016 - mfilka@suse.com
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 3.1.161
Version: 3.1.169
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
1 change: 1 addition & 0 deletions src/autoyast-rnc/networking.rnc
Expand Up @@ -15,6 +15,7 @@ networking =
dhcp_options? &
routing? &
dns? &
s390-devices? &
net-udev?
}

Expand Down
19 changes: 10 additions & 9 deletions src/include/network/lan/address.rb
Expand Up @@ -393,7 +393,7 @@ def initialize_network_lan_address(include_target)
Ops.set(
@widget_descr_local,
"HWDIALOG",
Ops.get(@widget_descr_hardware, "HWDIALOG", {})
Ops.get(widget_descr_hardware, "HWDIALOG", {})
)
end

Expand Down Expand Up @@ -1174,12 +1174,18 @@ def initIfplugdPriority(_key)
UI.ChangeWidget(
Id("IFPLUGD_PRIORITY"),
:Value,
Builtins.tointeger(Ops.get_string(@settings, "IFPLUGD_PRIORITY", "0"))
@settings["IFPLUGD_PRIORITY"].to_i
)

nil
end

# Stores content of IFPLUGD_PRIORITY widget into internal variables
def store_ifplugd_priority(_key, _event)
ifp_prio = UI.QueryWidget(Id("IFPLUGD_PRIORITY"), :Value).to_s
LanItems.ifplugd_priority = ifp_prio if !ifp_prio.empty?
end

def general_tab
type = LanItems.GetCurrentType

Expand Down Expand Up @@ -1408,7 +1414,8 @@ def AddressDialog
" then we need a way to decide which interface to take up. Therefore we have to\n" \
" set the priority of each interface. </p>\n"
),
"init" => fun_ref(method(:initIfplugdPriority), "void (string)")
"init" => fun_ref(method(:initIfplugdPriority), "void (string)"),
"store" => fun_ref(method(:store_ifplugd_priority), "void (string, map)")
)

Ops.set(wd, ["IFCFGTYPE", "items"], BuildTypesListCWM(NetworkInterfaces.GetDeviceTypes))
Expand Down Expand Up @@ -1504,12 +1511,6 @@ def AddressDialog
ifcfgname = Ops.get_string(LanItems.getCurrentItem, "ifcfg", "")
# general tab
LanItems.startmode = Ops.get_string(@settings, "STARTMODE", "")
if LanItems.startmode == "ifplugd"
ifp_prio = Builtins.tostring(
UI.QueryWidget(Id("IFPLUGD_PRIORITY"), :Value)
)
LanItems.ifplugd_priority = ifp_prio if !ifp_prio.nil?
end

if SuSEFirewall4Network.IsInstalled
zone = Ops.get_string(@settings, "FWZONE", "")
Expand Down
59 changes: 36 additions & 23 deletions src/include/network/lan/hardware.rb
Expand Up @@ -29,6 +29,8 @@

require "network/edit_nic_name"

include Yast::UIShortcuts

module Yast
module NetworkLanHardwareInclude
def initialize_network_lan_hardware(include_target)
Expand All @@ -49,19 +51,26 @@ def initialize_network_lan_hardware(include_target)
Yast.include include_target, "network/lan/cards.rb"

@hardware = nil
end

@widget_descr_hardware = {
"HWDIALOG" => {
"widget" => :custom,
"custom_widget" => ReplacePoint(Id(:hw_content), Empty()),
"init" => fun_ref(method(:initHwDialog), "void (string)"),
"handle" => fun_ref(method(:handleHW), "symbol (string, map)"),
"store" => fun_ref(method(:storeHW), "void (string, map)"),
"validate_type" => :function,
"validate_function" => fun_ref(method(:validate_hw), "boolean (string, map)"),
"help" => initHelp
}
def widget_descr_hardware
widget_descr = {
"widget" => :custom,
"custom_widget" => ReplacePoint(Id(:hw_content), Empty()),
"init" => fun_ref(method(:initHwDialog), "void (string)"),
"handle" => fun_ref(method(:handleHW), "symbol (string, map)"),
"store" => fun_ref(method(:storeHW), "void (string, map)"),
"help" => initHelp
}

# validation function currently checks user's input in :ifcfg_name widget
# However this widget is present only when adding new device
if isNewDevice
widget_descr["validate_type"] = :function
widget_descr["validate_function"] = fun_ref(method(:validate_hw), "boolean (string, map)")
end

{ "HWDIALOG" => widget_descr }
end

# Determines if the dialog is used for adding new device or for editing existing one.
Expand Down Expand Up @@ -790,21 +799,25 @@ def devname_from_hw_dialog
def validate_hw(_key, _event)
nm = devname_from_hw_dialog

if UsedNicName(nm)
ret = if UsedNicName(nm)
Popup.Error(
Builtins.sformat(
_(
"Configuration name %1 already exists.\nChoose a different one."
),
nm
)
format(_("Configuration name %s already exists.\nChoose a different one."), nm)
)

false
elsif !ValidNicName(nm)
Popup.Error(
format(_("Configuration name %s is invalid.\nChoose a different one."), nm)
)
UI.SetFocus(Id(:ifcfg_name))

return false
false
else
true
end

true
UI.SetFocus(Id(:ifcfg_name)) if !ret

ret
end

VLAN_SIZE = 4 # size of vlanN prefix without number
Expand All @@ -828,7 +841,7 @@ def storeHW(_key, _event)
end
if LanItems.type == "vlan"
# for vlan devices named vlanN pre-set vlan_id to N, otherwise default to 0
LanItems.vlan_id = nm[VLAN_SIZE].to_i.to_s
LanItems.vlan_id = nm[VLAN_SIZE..-1]
end
end

Expand Down Expand Up @@ -1232,7 +1245,7 @@ def S390Dialog
def HardwareDialog
caption = _("Hardware Dialog")

w = CWM.CreateWidgets(["HWDIALOG"], @widget_descr_hardware)
w = CWM.CreateWidgets(["HWDIALOG"], widget_descr_hardware)
contents = VBox(
VStretch(),
HBox(
Expand Down
21 changes: 20 additions & 1 deletion src/include/network/lan/udev.rb
Expand Up @@ -45,6 +45,25 @@ def update_udev_rule_key(rule, key, value)
rule
end

# Returns a value of the particular key in the rule
#
# @param rule [array] an udev rule represented as a list of strings
# @param key [string] a key name which is asked for value
# @return [string] value corresponding to the key or empty string
def udev_key_value(rule, key)
raise ArgumentError, "Rule must not be nil when querying a key value" if rule.nil?

rule.each do |tuple|
# note that when using =~ then named capture groups (?<name>...) currently
# cannot be used together with interpolation (#{})
# see http://stackoverflow.com/questions/15890729/why-does-capturing-named-groups-in-ruby-result-in-undefined-local-variable-or-m
matches = tuple.match(/#{key}={1,2}"?(?<value>[^[:space:]"]*)/)
return matches[:value] if matches
end

""
end

# Writes new persistent udev net rules and tells udevd to update its configuration
def write_update_udevd(udev_rules)
SCR.Write(path(".udev_persistent.rules"), udev_rules)
Expand All @@ -67,7 +86,7 @@ def update_udevd
path(".target.bash"),
"udevadm trigger --subsystem-match=net --action=add"
)
ret == 0
ret.zero?
end

# Removes (key,operator,value) tripplet from given udev rule.
Expand Down
5 changes: 1 addition & 4 deletions src/include/network/lan/virtual.rb
Expand Up @@ -185,9 +185,6 @@ def storeAdditional(_key, _event)
nil
end

# max length of device / interface filename lenght supported by kernel
IFACE_LABEL_MAX = 16

# Open a dialog to edit a name-ipaddr-netmask triple.
# @param id [Integer] an id for the table item to be returned
# @param entry [Yast::Term] an existing entry to be edited, or term(:empty)
Expand Down Expand Up @@ -239,7 +236,7 @@ def VirtualEditDialog(id, entry)
host = Item(Id(id))
val = UI.QueryWidget(Id(:name), :Value)

if LanItems.device.size + val.size + 1 > IFACE_LABEL_MAX
if !ValidNicName("#{LanItems.device}.#{val}")
# Popup::Error text
Popup.Error(_("Label is too long."))
UI.SetFocus(Id(:name))
Expand Down

0 comments on commit 21424b1

Please sign in to comment.