summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-10-09 19:30:04 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-10-09 19:30:04 (GMT)
commit439d98c65289f19662459106de1cc1a40ee2c5f4 (patch)
tree0be11057f77c0252afbf8204d6178bac8b266e3e
parentc253bf234deafa69ed2e462c8ec2d8f41b484e9e (diff)
first checks for showids
-rwxr-xr-xlib/RHRD/rddb.pm21
-rwxr-xr-xutils/rhrd-sanity-check35
2 files changed, 49 insertions, 7 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 67b431f..3a6bf21 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -952,6 +952,27 @@ sub list_shows
return @show_dbs;
}
+sub list_showids
+{
+ my ($ctx, $groupname) = @_;
+
+ my $sql = qq{select NUMBER from CART where GROUP_NAME = ? order by NUMBER};
+
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($ctx->{'config'}{'specialgroups'}{'shows'})
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my @showids;
+ while(my ($showid) = $sth->fetchrow_array()) {
+ push @showids, $showid;
+ }
+ $sth->finish();
+
+ return @showids;
+}
+
sub create_show_group
{
my ($ctx, $groupname) = @_;
diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check
index 6cfb2d7..13b2b45 100755
--- a/utils/rhrd-sanity-check
+++ b/utils/rhrd-sanity-check
@@ -281,9 +281,31 @@ sub check_showids
my ($ctx) = @_;
my $errors = 0,
- print "logs:\n";
- print " ... checks not yet implemtned!!\n";
+ print "showids:\n";
+
+ my @show_ids = RHRD::rddb::list_showids($ctx);
+ if(!defined $show_ids[0] && defined $show_ids[1]) {
+ print STDERR "$show_ids[1]: $show_ids[2]";
+ return -1;
+ }
+ for my $show_id (@show_ids) {
+ my @carts = RHRD::rddb::get_show_carts($ctx, $show_id);
+ if(!defined $carts[0] && defined $carts[1]) {
+ print " showid '" . $show_id . "': $carts[2]\n";
+ $errors++;
+ }
+ if(scalar @carts == 0) {
+ print " showid '" . $show_id . "': has no log assigned or log is empty\n";
+ $errors++;
+ }
+ my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $show_id);
+ unless(defined($group)) {
+ print " showid '" . $show_id . "': has no dropbox assigned\n";
+ $errors++;
+ } else {
+ }
+ }
print "\n " . $errors . " errors found\n";
return $errors;
@@ -296,7 +318,6 @@ sub check_logs
my $errors = 0,
print "logs:\n";
- print " ... checks not yet implemtned!!\n";
print "\n " . $errors . " errors found\n";
@@ -306,13 +327,13 @@ sub check_logs
my ($ctx, $status, $errorstring) = RHRD::rddb::init();
if(defined $ctx) {
- check_groups($ctx);
- print "\n";
- check_dropboxes($ctx);
- print "\n";
check_showids($ctx);
print "\n";
check_logs($ctx);
+ print "\n";
+ check_groups($ctx);
+ print "\n";
+ check_dropboxes($ctx);
RHRD::rddb::destroy($ctx);
} else {