Skip to content
Snippets Groups Projects
Commit e7abbed0 authored by Leo Gordon's avatar Leo Gordon
Browse files

quote and env-substitute runWorker.pl's -url commandline parameter

parent ad756fa6
No related branches found
No related tags found
No related merge requests found
......@@ -298,7 +298,7 @@ sub generate_worker_cmd {
if ($self->{'reg_alias'}) { # then we pass the connection parameters:
$worker_cmd .= ' -reg_alias '. $self->{'reg_alias'};
} else {
$worker_cmd .= ' -url '. $self->{'safe_url'};
$worker_cmd .= " -url '". $self->{'safe_url'} ."'";
}
foreach my $worker_option ('job_limit', 'life_span', 'retry_throwing_jobs', 'compile_module_once', 'hive_log_dir', 'debug') {
......
......@@ -72,6 +72,16 @@ my $DBA;
if($reg_alias) {
$DBA = Bio::EnsEMBL::Registry->get_DBAdaptor($reg_alias, 'hive');
} elsif($url) {
# Perform environment variable substitution separately with and without curly braces.
# Fixme: Perl 5.10 has a cute new "branch reset" (?|pattern)
# that would allow to merge the two substitutions below into a nice one-liner.
# But people around may still be using Perl 5.8, so let's wait a bit.
#
# Make sure expressions stay as they were if we were unable to substitute them.
#
$url =~ s/\$(\{(\w+)\})/defined($ENV{$2})?"$ENV{$2}":"\$$1"/eg;
$url =~ s/\$((\w+))/defined($ENV{$2})?"$ENV{$2}":"\$$1"/eg;
$DBA = Bio::EnsEMBL::Hive::URLFactory->fetch($url) or die "Unable to connect to '$url'\n";
} elsif ($db_conf->{'-host'} and $db_conf->{'-user'} and $db_conf->{'-dbname'}) {
$DBA = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( %$db_conf );
......
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