Bug 8476 - mysql port must be specified in settings.py even though marked as optional
Summary: mysql port must be specified in settings.py even though marked as optional
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.1
Hardware: x86 Multiple
: Low normal
Target Milestone: 2.1
Assignee: Elliot Smith
QA Contact: Alexandru Roman
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-10-09 22:29 UTC by Michael Wood
Modified: 2016-01-08 09:51 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wood 2015-10-09 22:29:31 UTC
The DATABASE_URL environ variable seems to be set/used by bitbake

If you do as advised/supported by django/db backend and leave the port as an empty string then the DATABASE_URL regex match goes wrong and bitbake refuses to start.

toastermain/settings.py
...
        'HOST': 'localhost', 
        'PORT': '3306',                      # Set to empty string for default.
    }


...

    elif dburl.startswith('mysql://'):

        # URL must be in this form: mysql://user:pass@host:port/name
        result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d+)/([^/]*)", dburl)
        if result is None:
            raise Exception("ERROR: Could not read mysql database url: %s" % dburl)
Comment 1 Michael Wood 2016-01-05 15:34:30 UTC
commit c464f34d5bd3aa4119aa3d1591ee7d55afe9b35f
Author: Elliot Smith <elliot.smith@intel.com>
Date:   Wed Dec 9 19:56:37 2015 -0800

    bitbake: toaster: Amend regex for MySQL database URLs
    
    The database URL detection doesn't admit a MySQL URL without a port.
    
    As this is a common case (e.g. you would set the HOST to a mysql.sock
    path if pointing at a local MySQL server, with no port setting),
    amend the regex so it will correctly recognise paths, as well
    as HOST:PORT URLs.

    (Bitbake rev: 89386aab888f806d5aa4a8083c06566e48d9445b)
Comment 2 Alexandru Roman 2016-01-08 09:51:06 UTC
Verified on master: 0f3ad7c77aa0f8bb7641af1886e1420cdfa8419f