Perl script not running on OpenShift/Cirrus/Hybrid Cloud but just fine locally

  cloud, docker, openshift, perl

I have a Perl script which runs inside a Docker container that gets run on IBM’s Hybrid Cloud/Cirrus/OpenShift (I apologize for the multiple names, I’m not sure which name is proper). It does an scp copy file copy. It uses this run3 module which basically shells out to run scp. I then parse this output. If I run this locally, in a docker-compose environment, it works. If I run this on Cirrus, it somehow does not get the stdout (or stderr). Here’s a snippet of the code is:

use MIME::Base64;
use IO::Socket::IP;
use IO::Socket::SSL;
use IPC::Run3;
use File::Copy;
use Net::SCP;
use String::ShellQuote qw( shell_quote );
sub RunScpCommand() 
{
    my $ssh_source= $_[0];
    my $ssh_target= $_[1];
    my ($out,$err);
    my $in = "${SSCJCL_USER_PW}n";
    my $full_command = "sshpass -p ".${SSCJCL_USER_PW}." scp ".${ssh_source}." ".${SSCJCL_USER_ID}."@".${SSCJCL_HOST_NAME}.":".${ssh_target};
    my $printed_full_command = $full_command;
    $printed_full_command =~ s/${SSCJCL_USER_PW}/<secret-password>/g;
    print ($printed_full_command."n");
    run3 $full_command,$in,$out,$err;
    print ($out."n");
    print ($err."n");
    return ($out,$err);
}

Here is an example of what I would have liked it to do:

sshpass -p <secret-password> scp /host-dirs/out/SSC.D051721.T200335.S91.CP037.JCL 
[email protected]:/u/sprntg1/SSC.D051721.T200335.S91.CP037.JCL

My script is getting the information it needs (files to process, other environment variables, etc). It can print the command that it was going to execute accurately. When it comes to executing it, I see nothing. I logged onto the server, and could find no evidence that these commands completed. Yet, when I add a sleep command (so I can stall the program before Cirrus gets rid of it), I can use these commands and they produce the intended output. Note that I run these commands under the same UID/GID as the Perl program on the CMD.

This should have worked on Cirrus, yet it does not.

It’s getting enough info to find the necessary inputs so I can’t understand what the difference is.

Source: Docker Questions

LEAVE A COMMENT