diff --git a/lam/lib/lamdaemon.pl b/lam/lib/lamdaemon.pl index 3d0e0f39..ffcf6efb 100755 --- a/lam/lib/lamdaemon.pl +++ b/lam/lib/lamdaemon.pl @@ -25,6 +25,10 @@ use Sys::Syslog; +# Defines the protocol version of the lamdaemon script. +# This will only be changed when additional commands are added etc. +my $LAMDAEMON_PROTOCOL_VERSION = 1; + my $SPLIT_DELIMITER = "###x##y##x###"; # set a known path @@ -134,8 +138,17 @@ print "$return\n"; # Runs tests to check the environment # sub runTest { + # protocol version check + if ($vals[2] eq 'version') { + if ($vals[3] eq $LAMDAEMON_PROTOCOL_VERSION) { + $return = "INFO,Version check ok"; + } + else { + $return = "ERROR,Version check failed. Please upgrade the lamdaemon script to the same version as your main LAM installation."; + } + } # basic test - if ($vals[2] eq 'basic') { + elsif ($vals[2] eq 'basic') { $return = "INFO,Basic test ok"; } # quota test @@ -165,6 +178,9 @@ sub runTest { } } } + else { + $return = "ERROR,Unknown test: $vals[2]"; + } } # diff --git a/lam/templates/tests/lamdaemonTest.php b/lam/templates/tests/lamdaemonTest.php index e5a517d3..49af073a 100644 --- a/lam/templates/tests/lamdaemonTest.php +++ b/lam/templates/tests/lamdaemonTest.php @@ -169,6 +169,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText, $container) { */ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota, $container) { $SPLIT_DELIMITER = "###x##y##x###"; + $LAMDAEMON_PROTOCOL_VERSION = '1'; $okImage = "../../graphics/pass.png"; $failImage = "../../graphics/fail.png"; @@ -260,6 +261,10 @@ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota, $contai $stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic", $stopTest, $handle, _("Execute lamdaemon"), $container); } + if (!$stopTest) { + $stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "version" . $SPLIT_DELIMITER . $LAMDAEMON_PROTOCOL_VERSION, $stopTest, $handle, _("Lamdaemon version"), $container); + } + if (!$stopTest) { $handle = lamTestConnectSSH($serverName); @$handle->login($userName, $credentials[1]);