summaryrefslogtreecommitdiff
path: root/rhautoimport.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rhautoimport.pm')
-rw-r--r--rhautoimport.pm34
1 files changed, 5 insertions, 29 deletions
diff --git a/rhautoimport.pm b/rhautoimport.pm
index 0f9f197..1af005f 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -28,8 +28,6 @@ package rhautoimport;
use File::Basename;
use File::Temp;
use File::Slurp;
-use IPC::Open3;
-use IO::Handle;
use LWP::Simple;
use XML::Feed;
use RHRD::rddb;
@@ -269,33 +267,11 @@ sub import_uri
sub pv_add_note
{
- my ( $title, $text, $id, $date, $type, $index ) = @_;
- my @script = ('python', '/srv/pv/pv/manage.py', 'addnote', $id, $date, $type);
- push(@script , $index) unless (!defined $index);
-
- my ($reader, $writer, $error ) = ( new IO::Handle, new IO::Handle, new IO::Handle );
- $writer->autoflush(1);
- local $SIG{CHLD} = 'DEFAULT';
- my $pid = open3($writer, $reader, $error, @script);
- binmode($reader, ":utf8");
- binmode($writer, ":utf8");
- binmode($error, ":utf8");
- print $writer $title . "\n" . $text;
- close $writer;
- waitpid $pid, 0;
- my $err_out = join('', <$error>);
- my $read_out = join('', <$reader>);
- if ( $? >> 8 ) {
- my $log = "\n\nPV: adding note returned non-zero value\n";
- $log .= "STDERR:\n" . $err_out . "\n" unless $err_out eq '';
- $log .= "STDOUT:\n" . $read_out . "\n" unless $read_out eq '';
- return(1, $log);
- } else {
- my $log = '';
- $log .= $read_out . "\n" unless $read_out eq '';
- $log .= $err_out . "\n" unless $err_out eq '';
- return(0, $log);
- }
+ my ($title, $text, $id, $date, $type, $index) = @_;
+ my @args = ($id, $date, $type);
+ push(@args , $index) if defined($index);
+
+ return RHRD::utils::pv_execute_action('addnote', $title . "\n" . $text, @args);
}
1;