qiita
qiita copied to clipboard
wrongly set mountpoint in qiita.data_directory when different roots in settings
trafficstars
The original code, see below, assumes that qc.working_dir and qc.base_data_dir have the same "root", so when they don't it creates a "weird" base. This happened in qiita-rc: ('/a/b/working_directory/', '/c/d/'), repestibly.
# When creating a type is expected that a new mountpoint is created
# for that type, note that we are going to check if there is an
# extra path for the mountpoint, which is useful for the test
# environment
qc = qiita_config
mp = relpath(qc.working_dir, qc.base_data_dir).replace(
'working_dir', '')
mp = mp + name if mp != '/' and mp != '' else name
sql = """INSERT INTO qiita.data_directory
(data_type, mountpoint, subdirectory, active)
VALUES (%s, %s, %s, %s)"""
qdb.sql_connection.TRN.add(sql, [name, mp, True, True])