diff options
Diffstat (limited to 'rhautoimport-dn')
-rwxr-xr-x | rhautoimport-dn | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/rhautoimport-dn b/rhautoimport-dn index 62ba332..c9ff637 100755 --- a/rhautoimport-dn +++ b/rhautoimport-dn @@ -40,6 +40,10 @@ my $RD_GROUP = "democracyn"; my $PV_ID = '111'; my $LAST_RUN = 0; +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "!!!This is the last attempt, there won't be a retry on error!!!\n"; $LAST_RUN = 1; @@ -154,6 +158,7 @@ for my $entry ($headlines_feed->entries) { print "\n\nwill import '$uri' to show $show_id, $show_title\n\n"; +my $exit_code = 0; my ($ret, $log) = rhautoimport::import_uri($show_id, $uri->as_string); if($ret) { print "\nImport Error:\n\n"; @@ -165,7 +170,15 @@ print "\nImport Success:\n\n"; print $log; if($sum_title ne "") { print "\n"; - rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1", 0); + ($ret, $log) = rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1", 0); + print $log; + if($ret) { + print "\nIgnoring failed note import - manual intervention necessary!\n"; + $exit_code = 23; + } +} else { + print "\nIgnoring missing note - manual intervention necessary!\n"; + $exit_code = 23; } unlink($STAT_FILE); @@ -173,4 +186,4 @@ open(my $fhs, '>', $STAT_FILE); print $fhs $file; close($fhs); -exit 0; +exit $exit_code; |