Ondřej Svoboda has posted comments on this change.
Change subject: netinfo: Replace misused asserts with InvalidConfiguration
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
Replace % with str.format()?
http://gerrit.ovirt.org/#/c/34361/2/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:
Line 859: for port in ports:
Line 860: if port in self.vlans:
Line 861: if vlan is not None:
Line 862: raise InvalidConfiguration(
Line 863: "Unexpected vlan: %s, expected: None" % vlan)
This is very bad change - if vlan is a tuple or a list with one item,
we wi
What do you think about adopting the str.format function, which has dealt with
the unfortunate ambiguity of the (deprecated) % operator, treating a scalar the same way
as a single-item iterable?
>> v = 'single value'
>> '{}'.format(v)
'single value'
>> v = ('single value',)
>> '{}'.format(v)
"('single value',)"
>> mv = ('value 1', 'value 2')
>> '{}'.format(mv)
"('value 1', 'value 2')"
Line 864: nic = getVlanDevice(port)
Line 865: vlan = getVlanID(port)
Line 866: if self.vlans[port]['iface'] != nic:
Line 867: raise InvalidConfiguration(
--
To view, visit
http://gerrit.ovirt.org/34361
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I99ee49aa7e2364f57112e2452e3eab3940b6b00a
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes