Bug 8895

Summary: Lsupdates throw error using mysql
Product: [Build System, Metadata & Runtime] Toaster Reporter: Alexandru Roman <alexandru.costinx.roman>
Component: toasterAssignee: Alexandru Roman <alexandru.costinx.roman>
Status: VERIFIED WORKSFORME QA Contact: Alexandru Roman <alexandru.costinx.roman>
Severity: normal    
Priority: Medium+ CC: belen.barros.pena, jessica.zhang, stanciux.mihail
Version: 2.1   
Target Milestone: 2.1 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Unknown (Hard to categorize)
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 8796    
Bug Blocks:    

Description Alexandru Roman 2016-01-07 14:15:26 UTC
Steps to reproduce:

1. Modify poky/bitbake/lib/toaster/toastermain/settings.py file to use mysql
Example: DATABASES = {
         'default': {
             'ENGINE': 'django.db.backends.mysql',
             'NAME': 'toaster_data',
             'USER': 'toaster',
             'PASSWORD': '12345',
             'HOST': '127.0.0.1',
             'PORT': '',
     }

2. Create database and user in mysql:
$ mysql -u root -p
     mysql> CREATE DATABASE toaster_data;
     mysql> CREATE USER 'toaster'@'localhost' identified by '12345';
     mysql> GRANT all on toaster_data.* to 'toaster'@'localhost';
     mysql> quit

3. run command: ./bitbake/lib/toaster/manage.py migrate

4. run command: ./bitbake/lib/toaster/manage.py lsupdates

Expected results:
 Command finished successfully.

Actually:
 An error is thrown:
  "An error occurred in the current transaction. You can't "
django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.

If you use sqlite3 lsupdates works fine.
Comment 1 Ed Bartosh 2016-01-20 13:54:13 UTC
Started to work on this.
Comment 2 Ed Bartosh 2016-01-20 14:06:34 UTC
Works for me just fine on master 68c7113a746694e25df2ac5d86171ed96b7c2e94: 

$ ../bitbake/lib/toaster/manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages, toastermain, bldcollector, toastergui, humanize
  Apply all migrations: sessions, admin, auth, contenttypes, orm, bldcontrol
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying orm.0001_initial... OK
  Applying bldcontrol.0001_initial... OK
  Applying orm.0002_auto_20151223_1528... OK
  Applying sessions.0001_initial... OK
$ ../bitbake/lib/toaster/manage.py lsupdates
$ echo $?
0

Assigning back to reporter. Please, try to reproduce it on current master.
Comment 3 Alexandru Roman 2016-01-20 14:59:50 UTC
Tested again on master: 68c7113a746694e25df2ac5d86171ed96b7c2e94 and works.
Put this on resolved worksforme.
Comment 4 Alexandru Roman 2016-01-21 09:54:05 UTC
Verified.