[PATCH] (v2) Add support for network team devices (#1003591)
Radek Vykydal
rvykydal at redhat.com
Wed Nov 13 19:53:13 UTC 2013
On 11/13/2013 02:12 PM, Vratislav Podzimek wrote:
> On Tue, 2013-11-12 at 14:33 +0100, Radek Vykydal wrote:
>> +
>> + def _getArgsAsStr(self):
>> + retval = F19_NetworkData._getArgsAsStr(self)
>> +
>> + # see the tests for format description
>> + if self.teamslaves:
>> + slavecfgs = []
>> + for slave, config in self.teamslaves:
>> + if config:
>> + config = "'" + config + "'"
>> + slavecfgs.append(slave+config)
>> + slavecfgs = ",".join(slavecfgs).replace('"', r'\"')
>> + retval += " --teamslaves=\"%s\"" % slavecfgs
> You can use ' --teamslaves="%s"' here and there making strings better
> readable.
Done.
> + # if not (our example), add empty config for the last device
> + else:
> + parts.append('')
> + # parts == ['eth1,eth2', '{"prio": 100}', ',eth3', '']
> + # zip devices with its configs
> ^^ their configs
Thanks.
> +class F20_TestCase(CommandTest):
> + command = "network"
> +
> + def runTest(self):
> +
> + # team device
> +
> + cmd = "network --device team0 --bootproto static --ip=10.34.102.222 --netmask=255.255.255.0 --gateway=10.34.102.254 --nameserver=10.34.39.2 --teamslaves=\"p3p1'{\\\"prio\\\": -10, \\\"sticky\\\": true}',p3p2'{\\\"prio\\\": 100}'\" --teamconfig=\"{\\\"runner\\\": {\\\"name\\\": \\\"activebackup\\\"}}\" --activate"
> Would be nice to use r'string' strings to avoid escaping backslashes and
> double quotes.
But how would I escape inner single quotes then?
More information about the anaconda-patches
mailing list