SoTest: read credentials from file

[?]
Apr 22, 2020, 10:05 AM
4VVBCVPDQCKMBD5O5QRYXVV7JL5ULRMXIG23JNTDVSLB2YCH4EPAC

Dependencies

Change contents

  • replacement in src/lib/Hydra/Plugin/SoTest.pm at line 33
    [2.861][2.861:904]()
    username = Aladdin
    password = OpenSesame
    [2.861]
    [2.904]
    authfile = /var/lib/hydra/sotest.auth # file containing «username»:«password»
  • replacement in src/lib/Hydra/Plugin/SoTest.pm at line 61
    [2.1360][2.1360:1495]()
    die 'SoTest username and password must be specified'
    unless ( defined $sotest->{username} and defined $sotest->{password} );
    [2.1360]
    [2.1495]
    die 'SoTest authfile is not specified'
    unless ( defined $sotest->{authfile} );
    open( my $authfile, "<", $sotest->{authfile} )
    or die "Cannot open Sotest authfile \${\$sotest->{authfile}}";
    close($authfile);
  • edit in src/lib/Hydra/Plugin/SoTest.pm at line 97
    [2.2456]
    [2.2456]
    my $sotest_username;
    my $sotest_password;
  • replacement in src/lib/Hydra/Plugin/SoTest.pm at line 100
    [2.2457][2.2457:2504]()
    _logIfDebug 'post job for ', $sotest_name;
    [2.2457]
    [2.2504]
    my $authfile;
    open( $authfile, "<", $sotest->{authfile} )
    or die "Cannot open Sotest authfile \${\$sotest->{authfile}}";
    while (<$authfile>) {
    if ( $_ =~ /(.+):(.+)/m ) {
    $sotest_username = $1;
    $sotest_password = $2;
    }
    }
    close($authfile);
    die "failed to parse username and password from ${\$sotest->{authfile}}"
    unless ( defined $sotest_username and defined $sotest_password );
    _logIfDebug "post job for $sotest_name";
  • replacement in src/lib/Hydra/Plugin/SoTest.pm at line 119
    [2.2541][2.2541:2640]()
    $ua->default_headers->authorization_basic( $sotest->{username},
    $sotest->{password} );
    [2.2541]
    [2.2640]
    $ua->default_headers->authorization_basic( $sotest_username,
    $sotest_password );