yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #55316
[Bug 1614897] Re: HasStandardAttributes __init__ consumes positional as description
Reviewed: https://review.openstack.org/357730
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=43a8d201361e9bbe644243503f397c16e8b0c5a5
Submitter: Jenkins
Branch: master
commit 43a8d201361e9bbe644243503f397c16e8b0c5a5
Author: Kevin Benton <kevin@xxxxxxxxxx>
Date: Fri Aug 19 01:34:45 2016 -0700
Fix init method for HasStandardAttributes
Puttting description in the signature of __init__ would make it
consume the first positional argument that was passed in. This
would lead to a difficult to understand traceback from sqlalchemy
when the object was initialized with a positional.
This correctly checks the kwargs for the description and any other
standard attributes rather than leaving it in a positional.
Closes-Bug: #1614897
Change-Id: I264bf5fbfc834d7f5d86a2ad03f5e68a91e2185c
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1614897
Title:
HasStandardAttributes __init__ consumes positional as description
Status in neutron:
Fix Released
Bug description:
The __init__ method of HasStandardAttributes incorrectly consumes the
first positional argument as the description which leads to difficult
to debug failures like the one below.
Traceback (most recent call last):
File "neutron/tests/unit/objects/qos/test_policy.py", line 383, in test_object_version
self._create_test_policy_with_bw_and_dscp())
File "neutron/tests/unit/objects/qos/test_policy.py", line 370, in _create_test_policy_with_bw_and_dscp
policy_obj, rule_obj_band = self._create_test_policy_with_bwrule()
File "neutron/tests/unit/objects/qos/test_policy.py", line 133, in _create_test_policy_with_bwrule
policy_obj = self._create_test_policy()
File "neutron/tests/unit/objects/qos/test_policy.py", line 129, in _create_test_policy
policy_obj.create()
File "neutron/objects/rbac_db.py", line 305, in func
return new_method(self, orig_method)
File "neutron/objects/rbac_db.py", line 247, in _create_hook
orig_create(self)
File "neutron/objects/qos/policy.py", line 144, in create
super(QosPolicy, self).create()
File "neutron/objects/base.py", line 498, in create
self.modify_fields_to_db(fields))
File "neutron/objects/db/api.py", line 59, in create_object
db_obj = model(**values)
File "<string>", line 4, in __init__
File "/home/administrator/code/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/state.py", line 306, in _initialize_instance
manager.dispatch.init_failure(self, args, kwargs)
File "/home/administrator/code/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/home/administrator/code/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/state.py", line 303, in _initialize_instance
return manager.original_init(*mixed[1:], **kwargs)
File "neutron/db/model_base.py", line 198, in __init__
super(HasStandardAttributes, self).__init__(*args, **kwargs)
File "/home/administrator/code/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py", line 650, in _declarative_constructor
setattr(self, k, kwargs[k])
File "/home/administrator/code/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/ext/associationproxy.py", line 276, in __set__
setattr(obj, self.target_collection, creator(values))
TypeError: __init__() takes exactly 1 argument (2 given)
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1614897/+subscriptions
References