On Mon, Jun 29, 2009 at 01:12:09PM +0100, Guido Trotter wrote:
>
> If an ident member of an IdentKeyVal relationship starts with no_ or -,
> handle it the same way we do for a key.
Uh, I'm confused. A member cannot be false or true, it means a sub-dict (until
now).
> Some unittests are added to
> check that check_ident_key_val behaves as expected.
>
> This patch also changes ForceDictType to, for now, fail on such an
> entry, and the same to happen when creating an instance or modifying its
> nics or disks.
>
> This behavior will be used later on to allow deletion of os entries in
> os parameters.
>
I don't understand how this will be used:
> +class TestIdentKeyVal(unittest.TestCase):
> + """Testing case for cli.check_ident_key_val"""
> +
> + def testIdentKeyVal(self):
> + """Test identkeyval"""
> + def cikv(value):
> + return cli.check_ident_key_val("option", "opt", value)
> +
> + self.assertEqual(cikv("foo:bar"), ("foo", {"bar": True}))
> + self.assertEqual(cikv("foo:bar=baz"), ("foo", {"bar": "baz"}))
> + self.assertEqual(cikv("bar:b=c,c=a"), ("bar", {"b": "c", "c": "a"}))
> + self.assertEqual(cikv("no_bar"), ("bar", False))
> + self.assertEqual(cikv("no_bar:foo"), ("bar", False))
So the 'foo' is just dropped?
> + self.assertEqual(cikv("no_bar:foo=baz"), ("bar", False))
And here, foo=baz is just dropped?
> + self.assertEqual(cikv("-foo"), ("foo", None))
> + self.assertEqual(cikv("-foo:a=c"), ("foo", None))
Same question here.