Fix tool migrations with config file changes, do everything from

manage_db.sh.
This commit is contained in:
Nate Coraor
2017-11-15 12:37:22 -05:00
parent 1062c705a2
commit c340d4ebec
4 changed files with 9 additions and 55 deletions
+6
View File
@@ -21,6 +21,12 @@ DATABASE = {
'default_sqlite_file': './database/universe.sqlite',
'config_override': 'GALAXY_CONFIG_',
},
"tools":
{
'repo': 'lib/tool_shed/galaxy_install/migrate',
'default_sqlite_file': './database/universe.sqlite',
'config_override': 'GALAXY_CONFIG_',
},
"tool_shed":
{
'repo': 'lib/galaxy/webapps/tool_shed/model/migrate',
@@ -55,11 +55,10 @@ def verify_tools(app, url, galaxy_config_file=None, engine_options={}):
if not app.config.running_functional_tests:
if tool_shed_accessible:
# Automatically update the value of the migrate_tools.version database table column.
config_arg = ''
cmd = ['sh', 'manage_db.sh', 'upgrade', 'tools']
if galaxy_config_file:
config_arg = " -c %s" % galaxy_config_file
cmd = 'sh manage_tools.sh%s upgrade' % config_arg
proc = subprocess.Popen(args=cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
cmd[2:2] = ['-c', galaxy_config_file]
proc = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
return_code = proc.wait()
output = proc.stdout.read(32768)
if return_code != 0:
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
cd `dirname $0`
: ${GALAXY_VIRTUAL_ENV:=.venv}
if [ -d "$GALAXY_VIRTUAL_ENV" ];
then
printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n"
. "$GALAXY_VIRTUAL_ENV/bin/activate"
fi
python ./scripts/manage_tools.py $@
-39
View File
@@ -1,39 +0,0 @@
from __future__ import print_function
import logging
import os.path
import sys
from ConfigParser import SafeConfigParser
from migrate.versioning.shell import main
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'lib')))
from galaxy.model.orm.scripts import read_config_file_arg
from galaxy.util.properties import load_app_properties
log = logging.getLogger(__name__)
config_file = read_config_file_arg(sys.argv, 'config/galaxy.ini', 'universe_wsgi.ini')
if not os.path.exists(config_file):
print("Galaxy config file does not exist (hint: use '-c config.ini' for non-standard locations): %s" % config_file)
sys.exit(1)
repo = 'lib/tool_shed/galaxy_install/migrate'
properties = load_app_properties(config_file=config_file)
cp = SafeConfigParser()
cp.read(config_file)
if config_file == 'config/galaxy.ini.sample' and 'GALAXY_TEST_DBURI' in os.environ:
# Running functional tests.
db_url = os.environ['GALAXY_TEST_DBURI']
elif "install_database_connection" in properties:
db_url = properties["install_database_connection"]
elif "database_connection" in properties:
db_url = properties["database_connection"]
elif "database_file" in properties:
db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % properties["database_file"]
else:
db_url = "sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE"
main(repository=repo, url=db_url)