From 586f131ebddc0051c48b419c5cabe07e756a665f Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Mon, 7 Mar 2011 15:06:32 +0000 Subject: [PATCH] use HYDRA_DATA/hydra.conf as default location for hydra.conf --- src/lib/Hydra/Helper/Nix.pm | 10 ++++++++-- src/script/hydra_build.pl.in | 3 +-- src/script/hydra_evaluator.pl.in | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index d3198a07..d514a7d2 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -10,7 +10,7 @@ use Hydra::Helper::CatalystUtils; our @ISA = qw(Exporter); our @EXPORT = qw( isValidPath - getHydraPath getHydraDBPath openHydraDB txn_do + getHydraPath getHydraDBPath openHydraDB getHydraConf txn_do registerRoot getGCRootsDir gcRootFor getPrimaryBuildsForView getPrimaryBuildTotal @@ -25,10 +25,16 @@ sub isValidPath { sub getHydraPath { my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra"; - die "The HYDRA_DATA directory does not exist!\n" unless -d $dir; + die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir; return $dir; } +sub getHydraConf { + my $conf = $ENV{"HYDRA_CONF"} || (getHydraPath . "/hydra.conf"); + die "The HYDRA_CONF file ($conf) does not exist!\n" unless -f $conf; + return $conf; +} + sub getHydraDBPath { my $db = $ENV{"HYDRA_DBI"}; diff --git a/src/script/hydra_build.pl.in b/src/script/hydra_build.pl.in index 26cc7f83..9c0509eb 100755 --- a/src/script/hydra_build.pl.in +++ b/src/script/hydra_build.pl.in @@ -23,8 +23,7 @@ STDOUT->autoflush(); my $db = openHydraDB; -my %config = new Config::General($ENV{"HYDRA_CONFIG"})->getall; - +my %config = new Config::General(getHydraConf)->getall; sub sendTwitterNotification { my ($build) = @_; diff --git a/src/script/hydra_evaluator.pl.in b/src/script/hydra_evaluator.pl.in index 2491bf3b..a04677d9 100755 --- a/src/script/hydra_evaluator.pl.in +++ b/src/script/hydra_evaluator.pl.in @@ -18,7 +18,7 @@ use Data::Dump qw(dump); STDOUT->autoflush(); my $db = openHydraDB; -my %config = new Config::General($ENV{"HYDRA_CONFIG"})->getall; +my %config = new Config::General(getHydraConf)->getall; sub fetchInputs {