Commit 7cffbee5 authored by Robert Ricci's avatar Robert Ricci
Browse files

Add a new 'rand' option that causes the output to be done in random

order. To be used to by the testsuite.
parent d6a3dcbe
...@@ -20,13 +20,14 @@ my $d = 0; #debug mode ...@@ -20,13 +20,14 @@ my $d = 0; #debug mode
if ($#ARGV >= 0 && $ARGV[0] =~ /^-?h/i ) { if ($#ARGV >= 0 && $ARGV[0] =~ /^-?h/i ) {
die("Usage:\navail [help] [type[=<type>]] [OS[=<OS>]] [ver[=<OS_ver>]]\n". die("Usage:\navail [help] [type[=<type>]] [OS[=<OS>]] [ver[=<OS_ver>]]\n".
" [includevirt]\n". " [includevirt] [rand]\n".
#" [deltas=<delta[,delta,...]>]". #" [deltas=<delta[,delta,...]>]".
# " [fixes=<fix_name[,fix_name,...]>]". # " [fixes=<fix_name[,fix_name,...]>]".
"\n". "\n".
"type \t= pc | shark\n"."OS \t= Linux | FreeBSD | NetBSD | ...\n". "type \t= pc | shark\n"."OS \t= Linux | FreeBSD | NetBSD | ...\n".
"ver \t= 6.2 | 3.4 | 4.0 | 5.2 | ...\n".#"deltas \t= anetd | ...\n". "ver \t= 6.2 | 3.4 | 4.0 | 5.2 | ...\n".#"deltas \t= anetd | ...\n".
"includevirt: Include virtual nodes\n". "includevirt: Include virtual nodes\n".
"rand: Randomize result order\n".
# "fixes \t\t= cron_off | sendmail_off | ...\n" # "fixes \t\t= cron_off | sendmail_off | ...\n"
"A field name alone will show that field in the display of available\n". "A field name alone will show that field in the display of available\n".
"nodes. A field name with '=' followed by a string will match nodes\n". "nodes. A field name with '=' followed by a string will match nodes\n".
...@@ -63,6 +64,12 @@ if ($args{"includevirt"}) { ...@@ -63,6 +64,12 @@ if ($args{"includevirt"}) {
$cond .= " ) "; $cond .= " ) ";
} }
if ($args{"rand"}) {
$order = "rand()";
} else {
$order = "priority";
}
my $os = 0; my $os = 0;
my $delta = 0; my $delta = 0;
...@@ -99,7 +106,7 @@ if ($os) { ...@@ -99,7 +106,7 @@ if ($os) {
# } # }
my $cmd = "select $cols from $join where $cond order by priority"; my $cmd = "select $cols from $join where $cond order by $order";
print "Sending cmd:\n$cmd\n" if $d; print "Sending cmd:\n$cmd\n" if $d;
......
Supports Markdown
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