launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06236
[Merge] lp:~jtv/maas/poke-name-into-attrs into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/poke-name-into-attrs into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/poke-name-into-attrs/+merge/91414
Don't require the "name" attribute when creating a new object; just check that if it's there, it is consistent with the name you give to the object.
--
https://code.launchpad.net/~jtv/maas/poke-name-into-attrs/+merge/91414
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/poke-name-into-attrs into lp:maas.
=== modified file 'src/provisioningserver/cobblerclient.py'
--- src/provisioningserver/cobblerclient.py 2012-02-02 20:14:32 +0000
+++ src/provisioningserver/cobblerclient.py 2012-02-03 11:14:18 +0000
@@ -344,6 +344,12 @@
:param name: Identifying name for the new object.
:param attributes: Dict mapping attribute names to values.
"""
+ if 'name' in attributes:
+ assert attributes['name'] == name, (
+ "Creating %s called '%s', but 'name' attribute is '%s'."
+ % (cls.object_type, name, attributes['name']))
+ else:
+ attributes['name'] = name
missing_attributes = (
set(cls.required_attributes) - set(attributes.keys()))
assert len(missing_attributes) == 0, (