diff options
author | Elliot Smith <elliot.smith@intel.com> | 2015-12-09 19:56:37 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-14 23:12:44 +0000 |
commit | 89386aab888f806d5aa4a8083c06566e48d9445b (patch) | |
tree | 94627f6461b913a7bb874cd92a315d0a81cc718f /lib/toaster/toastermain | |
parent | 7bca51277314f7c0b6ee0e0d470327dfd60d37fe (diff) | |
download | bitbake-contrib-89386aab888f806d5aa4a8083c06566e48d9445b.tar.gz |
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.
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastermain')
-rw-r--r-- | lib/toaster/toastermain/settings.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index 7c559bc7a..b6bdcd8e3 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -64,6 +64,7 @@ if 'sqlite' in DATABASES['default']['ENGINE']: if 'DATABASE_URL' in os.environ: dburl = os.environ['DATABASE_URL'] + if dburl.startswith('sqlite3://'): result = re.match('sqlite3://(.*)', dburl) if result is None: @@ -78,7 +79,7 @@ if 'DATABASE_URL' in os.environ: } elif dburl.startswith('mysql://'): # URL must be in this form: mysql://user:pass@host:port/name - result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d+)/([^/]*)", dburl) + result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d*)/([^/]*)", dburl) if result is None: raise Exception("ERROR: Could not read mysql database url: %s" % dburl) DATABASES['default'] = { |