commit/galaxy-central: natefoo: Fix scripts that use galaxy.model.orm.scripts' get_config method to find either config/galaxy.ini or universe_wsgi.ini. For the tool_shed database it'll find either config/tool_shed.ini or tool_shed_wsgi.ini. Also re-fix the unit test.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/02738142b8cf/ Changeset: 02738142b8cf User: natefoo Date: 2014-09-17 05:33:17+00:00 Summary: Fix scripts that use galaxy.model.orm.scripts' get_config method to find either config/galaxy.ini or universe_wsgi.ini. For the tool_shed database it'll find either config/tool_shed.ini or tool_shed_wsgi.ini. Also re-fix the unit test. Database and tool migrations won't work if you use galaxy.ini.sample. Perhaps it should automatically try appending .sample? Or we should really be encouraging people to use the config file properly. Affected #: 2 files diff -r ac8d29ffce549f2c1570b661e8747c5beed2e676 -r 02738142b8cf5e0372ac5c2b46eeff5f0ab8e87a lib/galaxy/model/orm/scripts.py --- a/lib/galaxy/model/orm/scripts.py +++ b/lib/galaxy/model/orm/scripts.py @@ -18,7 +18,7 @@ log = logging.getLogger( __name__ ) -DEFAULT_CONFIG_FILE = 'galaxy.ini' +DEFAULT_CONFIG_FILE = 'config/galaxy.ini' DEFAULT_CONFIG_PREFIX = '' DEFAULT_DATABASE = 'galaxy' @@ -26,17 +26,20 @@ "galaxy": { 'repo': 'lib/galaxy/model/migrate', + 'old_config_file': 'universe_wsgi.ini', 'default_sqlite_file': './database/universe.sqlite', }, "tool_shed": { 'repo': 'lib/galaxy/webapps/tool_shed/model/migrate', 'config_file': 'config/tool_shed.ini', + 'old_config_file': 'tool_shed_wsgi.ini', 'default_sqlite_file': './database/community.sqlite', }, "install": { 'repo': 'lib/galaxy/model/tool_shed_install/migrate', + 'old_config_file': 'universe_wsgi.ini', 'config_prefix': 'install_', 'default_sqlite_file': './database/install.sqlite', }, @@ -58,13 +61,16 @@ log.error( "database_connection contains an unknown SQLAlchemy database dialect: %s" % dialect ) -def read_config_file_arg( argv, default ): +def read_config_file_arg( argv, default, old_default ): if '-c' in argv: pos = argv.index( '-c' ) argv.pop(pos) config_file = argv.pop( pos ) else: - config_file = default + if not os.path.exists( default ) and os.path.exists( old_default ): + config_file = old_default + else: + config_file = default return config_file @@ -74,11 +80,12 @@ >>> from tempfile import mkdtemp >>> config_dir = mkdtemp() + >>> os.makedirs(os.path.join(config_dir, 'config')) >>> def write_ini(path, property, value): ... p = SafeConfigParser() ... p.add_section('app:main') ... p.set('app:main', property, value) - ... with open(os.path.join(config_dir, path), 'w') as f: p.write(f) + ... with open(os.path.join(config_dir, 'config', path), 'w') as f: p.write(f) >>> write_ini('tool_shed.ini', 'database_connection', 'sqlite:///pg/testdb1') >>> config = get_config(['manage_db.py', 'tool_shed'], cwd=config_dir) >>> config['repo'] @@ -98,7 +105,7 @@ database = 'galaxy' database_defaults = DATABASE[ database ] - config_file = read_config_file_arg( argv, database_defaults.get( 'config_file', DEFAULT_CONFIG_FILE ) ) + config_file = read_config_file_arg( argv, database_defaults.get( 'config_file', DEFAULT_CONFIG_FILE ), database_defaults.get( 'old_config_file' ) ) repo = database_defaults[ 'repo' ] config_prefix = database_defaults.get( 'config_prefix', DEFAULT_CONFIG_PREFIX ) default_sqlite_file = database_defaults[ 'default_sqlite_file' ] diff -r ac8d29ffce549f2c1570b661e8747c5beed2e676 -r 02738142b8cf5e0372ac5c2b46eeff5f0ab8e87a scripts/manage_tools.py --- a/scripts/manage_tools.py +++ b/scripts/manage_tools.py @@ -22,7 +22,7 @@ log = logging.getLogger( __name__ ) -config_file = read_config_file_arg( sys.argv, 'config/galaxy.ini' ) +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 ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org