Commit f6b8cc48 authored by Leo Gordon's avatar Leo Gordon
Browse files

pulled in password-hiding patches

parents 2c4f48c6 533187fa
...@@ -93,40 +93,40 @@ sub new { ...@@ -93,40 +93,40 @@ sub new {
unless($no_sql_schema_version_check) { unless($no_sql_schema_version_check) {
my $dbc = $self->dbc(); my $dbc = $self->dbc();
$url ||= $dbc->url(); my $safe_url = $dbc->url('EHIVE_PASS');
my $code_sql_schema_version = Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version() my $code_sql_schema_version = Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version()
|| die "DB($url) Could not establish code_sql_schema_version, please check that 'EHIVE_ROOT_DIR' environment variable is set correctly"; || die "DB($safe_url) Could not establish code_sql_schema_version, please check that 'EHIVE_ROOT_DIR' environment variable is set correctly";
my $db_sql_schema_version = eval { $self->get_MetaAdaptor->get_value_by_key( 'hive_sql_schema_version' ); }; my $db_sql_schema_version = eval { $self->get_MetaAdaptor->get_value_by_key( 'hive_sql_schema_version' ); };
if($@) { if($@) {
if($@ =~ /hive_meta.*doesn't exist/) { if($@ =~ /hive_meta.*doesn't exist/) {
die "\nDB($url) The 'hive_meta' table does not seem to exist in the database yet.\nPlease patch the database up to sql_schema_version '$code_sql_schema_version' and try again.\n"; die "\nDB($safe_url) The 'hive_meta' table does not seem to exist in the database yet.\nPlease patch the database up to sql_schema_version '$code_sql_schema_version' and try again.\n";
} else { } else {
die "DB($url) $@"; die "DB($safe_url) $@";
} }
} elsif(!$db_sql_schema_version) { } elsif(!$db_sql_schema_version) {
die "\nDB($url) The 'hive_meta' table does not contain 'hive_sql_schema_version' entry.\nPlease investigate.\n"; die "\nDB($safe_url) The 'hive_meta' table does not contain 'hive_sql_schema_version' entry.\nPlease investigate.\n";
} elsif($db_sql_schema_version < $code_sql_schema_version) { } elsif($db_sql_schema_version < $code_sql_schema_version) {
my $new_patches = Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_sql_schema_patches( $db_sql_schema_version, $dbc->driver ) my $new_patches = Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_sql_schema_patches( $db_sql_schema_version, $dbc->driver )
|| die "DB($url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version' but the code is already '$code_sql_schema_version'.\n" || die "DB($safe_url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version' but the code is already '$code_sql_schema_version'.\n"
."Unfortunately we cannot patch the database; you may have to create a new database or agree to run older code\n"; ."Unfortunately we cannot patch the database; you may have to create a new database or agree to run older code\n";
my $patcher_command = "$ENV{'EHIVE_ROOT_DIR'}/scripts/db_cmd.pl -url $url"; my $patcher_command = "$ENV{'EHIVE_ROOT_DIR'}/scripts/db_cmd.pl -url $safe_url";
die "DB($url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version' but the code is already '$code_sql_schema_version'.\n" die "DB($safe_url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version' but the code is already '$code_sql_schema_version'.\n"
."Please upgrade the database by applying the following patches:\n\n".join("\n", map { "\t$patcher_command < $_" } @$new_patches)."\n\nand try again.\n"; ."Please upgrade the database by applying the following patches:\n\n".join("\n", map { "\t$patcher_command < $_" } @$new_patches)."\n\nand try again.\n";
} elsif($code_sql_schema_version < $db_sql_schema_version) { } elsif($code_sql_schema_version < $db_sql_schema_version) {
die "DB($url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version', but your code is still '$code_sql_schema_version'.\n" die "DB($safe_url) sql_schema_version mismatch: the database's version is '$db_sql_schema_version', but your code is still '$code_sql_schema_version'.\n"
."Please update the code and try again.\n"; ."Please update the code and try again.\n";
} }
} }
......
...@@ -155,7 +155,9 @@ sub main { ...@@ -155,7 +155,9 @@ sub main {
script_usage(1); script_usage(1);
} }
$self->{'safe_url'} = $self->{'dba'}->dbc->url('WORKER_PASSWORD'); if( $self->{'url'} ) { # protect the URL that we pass to Workers by hiding the password in %ENV:
$self->{'url'} = $self->{'dba'}->dbc->url('EHIVE_PASS');
}
my $queen = $self->{'dba'}->get_Queen; my $queen = $self->{'dba'}->get_Queen;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment