Skip to content
Browse files

Added instructions to INSTALL.

Changes related to mail template in anste-manager notifier.

Tests slightly modified.

Added new scenario with one client for simple testing purposes.

Modified ansted init.d script to use hping2 instead of ping.


git-svn-id: http://subversion.warp.es/anste/trunk@103 18403268-a619-4aed-af80-3a7c80afbb3a
  • Loading branch information...
1 parent 725693e commit 13f9425c3d6918b7060c81ca786151ad159b5294 Jose Antonio Calvo committed
View
5 INSTALL
@@ -13,3 +13,8 @@ make install-anste-job
Soon will be Debian packages available in a repository, but you
can build your own ones with the provided debian/rules script.
+
+If you are going to use anste-manager is very recommendable to have
+HTTP and SMTP servers running on the machine. You can configure the path
+where the results should be stored in anste-manager.conf.
+
View
2 src/bin/anste
@@ -155,7 +155,7 @@ sub test # (file)
print "\nWriting HTML reports to $LOGPATH...";
my $htmlWriter = new ANSTE::Report::HTMLWriter($report);
my $FILE;
- open($FILE, '>', "$LOGPATH/report.html");
+ open($FILE, '>', "$LOGPATH/index.html");
$htmlWriter->write($FILE);
close($FILE);
print "Done.\n";
View
5 src/data/conf/anste-manager.conf
@@ -3,10 +3,13 @@ port = 8666
[logs]
execution = /tmp/anste-out
-result = /tmp/anste-logs
[mail]
address = anste-noreply@localhost
smtp = localhost
subject = ANSTE Job Notification
template = mail.tmpl
+
+[www]
+host = localhost
+dir = /var/www/anste
View
17 src/data/deploy/scripts/ansted
@@ -6,7 +6,9 @@ function notify_ready
# Wait for network ready
for i in `seq 1 20`
do
- ping -c1 `cat /var/local/anste.master | cut -f1 -d:` &> /dev/null
+ HOST=`cat /var/local/anste.master | cut -f1 -d:`
+ PORT=`cat /var/local/anste.master | cut -f2 -d:`
+ hping2 -c 1 -p $PORT $HOST &> /dev/null
if [ $? ]
then
break
@@ -14,7 +16,18 @@ function notify_ready
sleep 1
fi
done
- /usr/local/bin/anste-slave ready
+ # Try to notify
+ for i in `seq 1 5`
+ do
+ /usr/local/bin/anste-slave ready
+ if [ $? ]
+ then
+ break
+ else
+ sleep 1
+ echo -n "Retrying notification to ANSTE master"
+ fi
+ done
}
if [ ! -x /usr/local/bin/ansted ]
View
1 src/data/profiles/ebox
@@ -17,3 +17,4 @@ ebox-printers
ebox-jabber
ebox-ca
ebox-openvpn
+ebox-soap
View
19 src/data/scenarios/one-client.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scenario>
+ <name>One client scenario</name>
+ <desc>Only one sarge base system.</desc>
+
+ <host>
+ <name>test-client</name>
+ <desc>Test machine.</desc>
+ <baseimage>sarge-mini</baseimage>
+ <network>
+ <interface type="static">
+ <name>eth1</name>
+ <address>192.168.3.1</address>
+ <netmask>255.255.255.0</netmask>
+ <gateway>192.168.3.128</gateway>
+ </interface>
+ </network>
+ </host>
+</scenario>
View
4 src/data/templates/mail.tmpl
@@ -1,7 +1,7 @@
-Helo {$user},
+Hello {$user},
Your test {$test} has finished!
-You can see the results here: http://noresultshere.com/anste/{$user}
+You can see the results here: {$results}
Have a nice day!
View
4 src/data/tests/ebox/samba/test-smbclient/pre
@@ -1,4 +1,6 @@
#!/bin/sh
export DEBIAN_FRONTEND=NONINTERACTIVE
-apt-get install -y -o Dpkg::Options::=--force-confdef smbclient
+OPTIONS='-o Dpkg::Options::=--force-confnew -o Dpkg::Options::=--force-confdef'
+apt-get update
+apt-get install -y $OPTIONS smbclient
View
37 src/lib/ANSTE/Manager/Config.pm
@@ -160,7 +160,7 @@ sub mailTemplate
my $template = $self->_getOption('mail', 'template');
- if (not ANSTE::Validate::template("$template")) {
+ if (not ANSTE::Validate::template($template)) {
throw ANSTE::Exceptions::InvalidConfig('mail/template',
$template,
$self->{confFile});
@@ -169,6 +169,36 @@ sub mailTemplate
return $template;
}
+sub wwwDir
+{
+ my ($self) = @_;
+
+ my $dir = $self->_getOption('www', 'dir');
+
+ if (not ANSTE::Validate::path($dir)) {
+ throw ANSTE::Exceptions::InvalidConfig('www/dir',
+ $dir,
+ $self->{confFile});
+ }
+
+ return $dir;
+}
+
+sub wwwHost
+{
+ my ($self) = @_;
+
+ my $host = $self->_getOption('www', 'host');
+
+ if (not ANSTE::Validate::host($host)) {
+ throw ANSTE::Exceptions::InvalidConfig('www/host',
+ $host,
+ $self->{confFile});
+ }
+
+ return $host;
+}
+
sub _getOption # (section, option)
{
my ($self, $section, $option) = @_;
@@ -204,7 +234,10 @@ sub _setDefaults
$self->{default}->{'mail'}->{'address'} = 'anste-noreply@foo.bar';
$self->{default}->{'mail'}->{'smtp'} = 'localhost';
$self->{default}->{'mail'}->{'subject'} = 'ANSTE Job Notification';
- $self->{default}->{'mail'}->{'subject'} = 'mail.tmpl'
+ $self->{default}->{'mail'}->{'subject'} = 'mail.tmpl';
+
+ $self->{default}->{'www'}->{'host'} = 'localhost';
+ $self->{default}->{'www'}->{'dir'} = '/var/www/anste';
}
1;
View
10 src/lib/ANSTE/Manager/JobLauncher.pm
@@ -55,7 +55,7 @@ sub _launch # (job)
my $EXDIR = ANSTE::Manager::Config->instance()->executionLog();
- my $TESTDIR = ANSTE::Manager::Config->instance()->resultLog();
+ my $WWWDIR = ANSTE::Manager::Config->instance()->wwwDir();
if (not -d $EXDIR) {
mkdir($EXDIR) or die "Can't mkdir: $!";
@@ -63,14 +63,16 @@ sub _launch # (job)
my $execlog = "$test.log";
$execlog =~ tr{/}{-};
- if (not -d $TESTDIR) {
- mkdir($TESTDIR) or die "Can't mkdir: $!";
+ my $userdir = "$WWWDIR/$user";
+
+ if (not -d $userdir) {
+ mkdir($userdir) or die "Can't mkdir: $!";
}
my $testlog = "$test-results";
$testlog =~ tr{/}{-};
print "Running test '$test' from user '$user'...\n";
- my $command = "bin/anste -t $test -o $TESTDIR/$testlog";
+ my $command = "bin/anste -t $test -o $userdir/$testlog";
$self->_executeSavingLog($command, "$EXDIR/$execlog");
print "Execution of test '$test' from user '$user' finished.\n";
View
7 src/lib/ANSTE/Manager/MailNotifier.pm
@@ -48,6 +48,7 @@ sub sendNotify # (job)
my $address = $config->mailAddress();
my $smtp = $config->mailSmtp();
my $templFile = $config->mailTemplate();
+ my $wwwHost = $config->wwwHost();
my $sender = new Mail::Sender {from => $address, smtp => $smtp};
ref($sender) or
@@ -60,7 +61,11 @@ sub sendNotify # (job)
my $template = new Text::Template(SOURCE => "$tmplPath/$templFile")
or die "Couldn't construct template: $Text::Template::ERROR";
- my %vars = (user => $user, test => $test);
+ my $results = "http://$wwwHost/anste/$user/$test-results/";
+
+ my %vars = (user => $user,
+ test => $test,
+ results => $results);
my $body = $template->fill_in(HASH => \%vars)
or die "Couldn't fill in the template: $Text::Template::ERROR";
View
7 src/lib/ANSTE/System/Debian.pm
@@ -90,10 +90,12 @@ sub installBasePackages
{
my ($self) = @_;
+ my @PACKAGES = ('libsoap-lite-perl', 'liberror-perl', 'hping2');
+
$self->execute('apt-get update')
or die "apt-get update failed: $!";
- my $ret = $self->_installPackages('libsoap-lite-perl liberror-perl');
+ my $ret = $self->_installPackages(@PACKAGES);
$self->execute('apt-get clean')
or die "apt-get clean failed: $!";
@@ -524,7 +526,7 @@ sub _routeCommand # (route)
sub _installPackages # (list)
{
- my ($self, $list) = @_;
+ my ($self, @list) = @_;
$ENV{DEBIAN_FRONTEND} = 'noninteractive';
@@ -532,6 +534,7 @@ sub _installPackages # (list)
my $forceDef = '-o DPkg::Options::=--force-confdef';
my $options = "-y $forceNew $forceDef";
+ my $list = join(' ', @list);
my $command = "apt-get install $options $list";
$self->execute($command);
View
5 src/lib/ANSTE/Test/Runner.pm
@@ -212,9 +212,10 @@ sub _runTest # (test)
unlink($video);
}
else {
- $testResult->setVideo($video);
+ $testResult->setVideo("video/$name.ogg");
}
}
+ $testResult->setLog("out/$name.html");
}
else {
if (not -r "$path/test") {
@@ -223,6 +224,7 @@ sub _runTest # (test)
}
$log = "$logPath/out/$name.txt";
$ret = $self->_runScript($hostname, "$path/test", $log);
+ $testResult->setLog("out/$name.txt");
}
# Run pre-test script if exists
@@ -231,7 +233,6 @@ sub _runTest # (test)
}
$testResult->setValue($ret);
- $testResult->setLog($log);
return $testResult;
}

0 comments on commit 13f9425

Please sign in to comment.
Something went wrong with that request. Please try again.