[omd-commits] OMD Git: omd: nagvis tests: Using htpasswd2 when htpasswd not available

git version control git at mathias-kettner.de
Sat Dec 3 12:11:59 CET 2011


Module:   omd
Branch:   master
Commit:   5d17d1a525ed9b294a1d11b3a77ca8ccf73ee558
URL:      http://omdistro.org/projects/omd/repository/revisions/5d17d1a525ed9b294a1d11b3a77ca8ccf73ee558

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Sat Dec  3 12:10:52 2011 +0100
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Sat Dec  3 12:10:52 2011 +0100

nagvis tests: Using htpasswd2 when htpasswd not available

---

 t/20-package_nagvis.t |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/t/20-package_nagvis.t b/t/20-package_nagvis.t
index 92262fc..790aa7f 100644
--- a/t/20-package_nagvis.t
+++ b/t/20-package_nagvis.t
@@ -174,7 +174,12 @@ for my $url ( @{$urls} ) {
 # Environment auth tests
 
 # Create user "omduser" in omd site
-TestUtils::test_command({ cmd  => "/bin/su - $site -c 'htpasswd -b /omd/sites/$site/etc/htpasswd omduser test 2>/dev/null'"});
+# SLES11 does not have a "htpasswd" binary. Use the available htpasswd2 binary in that case.
+my $htpasswd = "htpasswd";
+if(system("which $htpasswd >/dev/null 2>&1") != 0) {
+    $htpasswd = "htpasswd2";
+}
+TestUtils::test_command({ cmd  => "/bin/su - $site -c '$htpasswd -b /omd/sites/$site/etc/htpasswd omduser test 2>/dev/null'"});
 
 # Now try to auth with that user (environment auth)
 $auth = 'OMD Monitoring Site '.$site.':omduser:test';



More information about the omd-commits mailing list