Hide Forgot
Description of problem: Inventory fails to update the database because of SQL error. Version-Release number of selected component (if applicable): beaker-server-0.6.8-5.el5 MySQL database How reproducible: always Steps to Reproduce: 1. Install Beaker server environment 2. Add new machine to the lab controller 3. Upload the inventory test case 4. Run the inventory test case using RHEL5.6 Actual results: Test case traceback due to internal server error while handling the XMLRPC request. Expected results: PASS Additional info: This is what my server.log says: 04/May/2011:20:45:16 HTTP INFO Page handler: <bound method Root.RPC2 of <bkr.server.controllers.Root object at 0x2b431f87c7d0>> Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 121, in _run self.main() File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 264, in main body = page_handler(*virtual_path, **self.params) File "<string>", line 3, in RPC2 File "/usr/lib/python2.4/site-packages/turbogears/controllers.py", line 358, in expose output = database.run_with_transaction( File "<string>", line 5, in run_with_transaction File "/usr/lib/python2.4/site-packages/turbogears/database.py", line 434, in sa_rwt session.commit() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/scoping.py", line 98, in do return getattr(self.registry(), name)(*args, **kwargs) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 557, in commit self.transaction.commit() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 262, in commit self._prepare_impl() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 246, in _prepare_impl self.session.flush() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 789, in flush self.uow.flush(self, objects) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 237, in flush flush_context.execute() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 449, in execute UOWExecutor().execute(self, tasks) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 934, in execute self.execute_save_steps(trans, task) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 949, in execute_save_steps self.save_objects(trans, task) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 940, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 1161, in _save_obj c = connection.execute(statement.values(value_params), params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 844, in execute return Connection.executors[c](self, object, multiparams, params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 895, in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 907, in _execute_compiled self.__execute_raw(context) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) OperationalError: (OperationalError) (1048, "Column 'type_id' cannot be null") u'INSERT INTO system (fqdn, serial, date_added, date_modified, date_lastcheckin, location, vendor, model, lender, owner_id, user_id, type_id, status_id, status_reason, shared, private, deleted, memory, checksum, lab_controller_id, mac_address, loan_id, release_action_id, reprovision_distro_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' ['tester1', None, datetime.datetime(2011, 5, 4, 17, 45, 16, 759890), datetime.datetime(2011, 5, 4, 17, 45, 16, 701741), None, None, None, None, None, None, None, None, None, None, 0, 0, 0, None, None, None, None, None, None, None] Error handling XML-RPC method Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/bkr/server/xmlrpccontroller.py", line 38, in RPC2 response = obj(*params) File "/usr/lib/python2.4/site-packages/bkr/server/controllers.py", line 1798, in push return system.update(inventory) File "/usr/lib/python2.4/site-packages/bkr/server/model.py", line 2108, in update method(inventory[key]) File "/usr/lib/python2.4/site-packages/bkr/server/model.py", line 2197, in updateNuma if numainfo.get('nodes', None) is not None: AttributeError: 'int' object has no attribute 'get' 04/May/2011:20:45:18 HTTP INFO Page handler: <bound method Root.RPC2 of <bkr.server.controllers.Root object at 0x2b431f87c7d0>> Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 121, in _run self.main() File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 264, in main body = page_handler(*virtual_path, **self.params) File "<string>", line 3, in RPC2 File "/usr/lib/python2.4/site-packages/turbogears/controllers.py", line 358, in expose output = database.run_with_transaction( File "<string>", line 5, in run_with_transaction File "/usr/lib/python2.4/site-packages/turbogears/database.py", line 434, in sa_rwt session.commit() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/scoping.py", line 98, in do return getattr(self.registry(), name)(*args, **kwargs) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 557, in commit self.transaction.commit() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 262, in commit self._prepare_impl() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 246, in _prepare_impl self.session.flush() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 789, in flush self.uow.flush(self, objects) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 237, in flush flush_context.execute() File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 449, in execute UOWExecutor().execute(self, tasks) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 934, in execute self.execute_save_steps(trans, task) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 949, in execute_save_steps self.save_objects(trans, task) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 940, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 1161, in _save_obj c = connection.execute(statement.values(value_params), params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 844, in execute return Connection.executors[c](self, object, multiparams, params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 895, in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 907, in _execute_compiled self.__execute_raw(context) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) OperationalError: (OperationalError) (1048, "Column 'type_id' cannot be null") u'INSERT INTO system (fqdn, serial, date_added, date_modified, date_lastcheckin, location, vendor, model, lender, owner_id, user_id, type_id, status_id, status_reason, shared, private, deleted, memory, checksum, lab_controller_id, mac_address, loan_id, release_action_id, reprovision_distro_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' ['tester1', None, datetime.datetime(2011, 5, 4, 17, 45, 18, 335430), None, datetime.datetime(2011, 5, 4, 17, 45, 17, 601920), None, 'Red Hat', None, None, None, None, None, None, None, 0, 0, 0, None, '318fd253f18846b7a63aca2d7cab22f8', None, None, None, None, None]
I think there are 2 errors in this log. After the SQL error we have: Error handling XML-RPC method Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/bkr/server/xmlrpccontroller.py", line 38, in RPC2 response = obj(*params) File "/usr/lib/python2.4/site-packages/bkr/server/controllers.py", line 1798, in push return system.update(inventory) File "/usr/lib/python2.4/site-packages/bkr/server/model.py", line 2108, in update method(inventory[key]) File "/usr/lib/python2.4/site-packages/bkr/server/model.py", line 2197, in updateNuma if numainfo.get('nodes', None) is not None: AttributeError: 'int' object has no attribute 'get' which looks like another error. Btw tester1.example.com is a KVM virtual guest which I've added. /distribution/install test case works fine.
We should handle this error better. But I'm not sure we want an inventory job to automatically create a system record. Especially now that we require all systems to be owned by someone.
I think the first error comes from the fact that hostname reports tester1 instead of the FQDN. (In reply to comment #2) > We should handle this error better. But I'm not sure we want an inventory job > to automatically create a system record. Especially now that we require all > systems to be owned by someone. How would I update the inventory details then? Just FYI in the webUI the system is marked as owned by admin and I'm executing the test case as admin too.
Nevermind comment #3. I tried to execute the job manually with the correct hostname and the details page was updated. We still have 2 issues: 1) If push-inventory.py is called with a hostname that is not found in the database (tester1 vs. tester1.example.com) the XMLRPC call crashes. It should exit nicely and possibly the test case should report FAIL. 2) We still have the error from comment #1 which is produced by pushInventory.py when run on a KVM guest. According to Bill this is easy to fix.
(In reply to comment #2) > We should handle this error better. But I'm not sure we want an inventory job > to automatically create a system record. Especially now that we require all > systems to be owned by someone. Agreed. There are better ways to create systems en masse if that is desired (e.g. CSV import). This is more likely to be masking a problem, such as a mismatched hostname as encountered by Alexander. (In reply to comment #4) > 1) If push-inventory.py is called with a hostname that is not found in the > database (tester1 vs. tester1.example.com) the XMLRPC call crashes. It should > exit nicely and possibly the test case should report FAIL. I have pushed a patch to gerrit which will give a nicer XML-RPC fault message in this case: xmlrpclib.Fault: <Fault 1: "bkr.server.bexceptions.BX:'No such system notexist.invalid'"> instead of xmlrpclib.ProtocolError: <ProtocolError for localhost:8080/RPC2: 500 Internal error> In either case the inventory scripts will exit with a non-zero status code, so this should have been reported as a FAIL when run in beaker. Alexander, if that is not the case can you please show us the job where it happened? > 2) We still have the error from comment #1 which is produced by > pushInventory.py when run on a KVM guest. According to Bill this is easy to > fix. This was a typo in pushInventory.py, which would only be hit when our patched version of smolt is not installed on the test machine. Fix pushed to gerrit.
Hello, Your ticket is ready for testing and is currently running on https://beaker-stage.app.eng.bos.redhat.com Please ensure your request for beaker has been adequately addressed by testing it on the above machine. Testing will be available up until COB on the 20th April. Thank you Beaker development team