Univention Bugzilla – Attachment 6264 Details for
Bug 36341
bond-primary is never written to UCR
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix bond-primary UCR variable
36341-USS-Fix-bond-primary-UCR-variable.patch (text/plain), 3.85 KB, created by
Philipp Hahn
on 2014-10-30 13:14 CET
(
hide
)
Description:
Fix bond-primary UCR variable
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2014-10-30 13:14 CET
Size:
3.85 KB
patch
obsolete
>From db44161e1a4b2c9adecfeac7174a4c33cbf8df31 Mon Sep 17 00:00:00 2001 >Message-Id: <db44161e1a4b2c9adecfeac7174a4c33cbf8df31.1414671238.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Thu, 30 Oct 2014 13:12:53 +0100 >Subject: [PATCH] Bug #36341 USS: Fix bond-primary UCR variable >Organization: Univention GmbH, Bremen, Germany > >The front-end pushes a string variable, while the code only checks for >an integer type. >On the other hand when the interfaces are read from the UCR variables, >it is converted to int already. > >Also fix the very broken handling when the mode is specified by name >instead of its integer value. >--- > .../base/univention-system-setup/debian/changelog | 1 + > .../umc/python/setup/network.py | 27 ++++++++++------------ > 2 files changed, 13 insertions(+), 15 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/debian/changelog b/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/debian/changelog >index 020abfb..f4359b0 100644 >--- a/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/debian/changelog >+++ b/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/debian/changelog >@@ -1,6 +1,7 @@ > univention-system-setup (7.0.69-62) unstable; urgency=low > > * Bug #36339: Fix miimon UCR variable >+ * Bug #36341: Fix bond-primary UCR variable > > -- Philipp Hahn <hahn@univention.de> Wed, 29 Oct 2014 15:03:49 +0100 > >diff --git a/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/umc/python/setup/network.py b/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/umc/python/setup/network.py >index ce6039f..4d945e6 100644 >--- a/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/umc/python/setup/network.py >+++ b/branches/ucs-3.2/ucs-3.2-3/base/univention-system-setup/umc/python/setup/network.py >@@ -109,10 +109,6 @@ class Interfaces(dict): > device = Device.from_dict(values, self) > self[device.name] = device > >-# def finalize(self): >-# self.check_consistency() >-# return self.to_ucr() >- > def to_ucr(self): > """Returns a UCR representation of all interfaces""" > ucr.load() >@@ -636,7 +632,7 @@ class VLAN(Device): > class Bond(Device): > """A network bonding interface""" > >- modes = { >+ MODES = { > 'balance-rr': 0, > 'active-backup': 1, > 'balance-xor': 2, >@@ -645,7 +641,7 @@ class Bond(Device): > 'balance-tlb': 5, > 'balance-alb': 6 > } >- modes_r = dict((v, k) for k, v in modes.iteritems()) >+ MODES_R = dict((v, k) for k, v in MODES.iteritems()) > > def clear(self): > super(Bond, self).clear() >@@ -696,13 +692,14 @@ class Bond(Device): > self.check_unique_interface_usage() > > def validate_bond_mode(self): >- if self.bond_mode is not None: >- try: >- bond_mode = int(self.bond_mode) >- if bond_mode not in self.modes_r and bond_mode not in self.modes: >- raise ValueError >- except ValueError: >- raise DeviceError(_('Invalid bond-mode: %r') % (self.bond_mode), self.name) >+ if self.bond_mode is None: >+ return >+ if self.bond_mode in self.MODES: >+ return >+ try: >+ self.MODES_R[int(self.bond_mode)] >+ except (ValueError, KeyError): >+ raise DeviceError(_('Invalid bond-mode: %r') % (self.bond_mode,), self.name) > > @property > def subdevice_names(self): >@@ -726,7 +723,7 @@ class Bond(Device): > self.bond_mode = int(value) > except ValueError: > try: >- self.bond_mode = self.modes[value.strip()] >+ self.bond_mode = self.MODES[value.strip()] > except KeyError: > pass # invalid mode > elif name in ('bond-miimon', 'miimon'): >@@ -744,7 +741,7 @@ class Bond(Device): > 'bond-slaves %s' % (' '.join(self.bond_slaves),), > 'bond-mode %s' % (self.bond_mode,), > ] >- if self.bond_mode == 1 and self.bond_primary: >+ if self.bond_mode in (1, '1') and self.bond_primary: > options.append('bond-primary %s' % (' '.join(self.bond_primary),)) > if self.miimon is not None: > options.append('bond-miimon %s' % (self.miimon,)) >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 36341
: 6264