summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastermain/settings.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-12-09 19:56:37 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-14 23:13:07 +0000
commitc464f34d5bd3aa4119aa3d1591ee7d55afe9b35f (patch)
tree1002196c9231aaf69f66633b46d1d82e1f394a7e /bitbake/lib/toaster/toastermain/settings.py
parentf001a4ac3cfd83405c85b62cf2509fab785bcf49 (diff)
downloadpoky-c464f34d5bd3aa4119aa3d1591ee7d55afe9b35f.tar.gz
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) 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 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index 7c559bc7a1..b6bdcd8e3e 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -64,6 +64,7 @@ if 'sqlite' in DATABASES['default']['ENGINE']:
64 64
65if 'DATABASE_URL' in os.environ: 65if 'DATABASE_URL' in os.environ:
66 dburl = os.environ['DATABASE_URL'] 66 dburl = os.environ['DATABASE_URL']
67
67 if dburl.startswith('sqlite3://'): 68 if dburl.startswith('sqlite3://'):
68 result = re.match('sqlite3://(.*)', dburl) 69 result = re.match('sqlite3://(.*)', dburl)
69 if result is None: 70 if result is None:
@@ -78,7 +79,7 @@ if 'DATABASE_URL' in os.environ:
78 } 79 }
79 elif dburl.startswith('mysql://'): 80 elif dburl.startswith('mysql://'):
80 # URL must be in this form: mysql://user:pass@host:port/name 81 # URL must be in this form: mysql://user:pass@host:port/name
81 result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d+)/([^/]*)", dburl) 82 result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d*)/([^/]*)", dburl)
82 if result is None: 83 if result is None:
83 raise Exception("ERROR: Could not read mysql database url: %s" % dburl) 84 raise Exception("ERROR: Could not read mysql database url: %s" % dburl)
84 DATABASES['default'] = { 85 DATABASES['default'] = {