IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35363


Ignore:
Timestamp:
Apr 4, 2013, 11:39:06 AM (13 years ago)
Author:
bills
Message:

Process the new request header words added in version 2 of the request spec

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r34447 r35363  
    9393my $fields_output;
    9494{
    95     my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION USER EMAIL";
     95    my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL";
    9696    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9797        run(command => $command, verbose => $verbose);
     
    102102    $fields_output = join "", @$stdout_buf;
    103103}
    104 my (undef, $extname, $extver, $req_name, $action, $username, $email) = split " ", $fields_output;
     104my (undef, $extname, $extver, $req_name, $action, $email) = split " ", $fields_output;
    105105
    106106# make sure the file contains what we are expecting
    107107# This program shouldn't have been run if the request file is bogus.
    108 # No need to notify the client
    109108my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST";
    110109my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR)  if (!$req_name);
    111110my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2");
    112111
     112if ($extver >= 2) {
     113    # We have a version 2 file. Require that the new keywords be supplied.
     114    my_die("action not supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless defined $action;
     115
     116    my_die("invalid action: $action supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW');
     117
     118    my_die("email not supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless $email;
     119    # XXX check for "valid" $email
     120} else {
     121    # for version 1 file the action is process and email is not used
     122    $action = 'PROCESS';
     123    $email = 'null';
     124}
     125
     126print "Request Header Keywords EXTVER: $extver REQ_NAME: $req_name ACTION: $action EMAIL: $email\n";
    113127
    114128# check for duplicate request name
     
    161175    # the output data store's product name
    162176    my $command = "$pstamptool -updatereq -req_id $req_id  -set_name $req_name";
     177    $command .= " -set_username $email" if $email ne 'null';
    163178    $command .= " -set_outProduct $product";
    164179    $command .= " -set_label $label" if $label_changed;
     
    362377        return 0;
    363378    }
    364 
    365     # $mode list_uri is a debugging mode (it may used by the http interface)
    366     # if this happens just croak
    367    # my_die("job_type is list_uri but mode is $mode", $PS_EXIT_PROG_ERROR) if ($job_type eq "list_uri") and ($mode ne "list_uri");
    368 
    369379
    370380    if ($req_type eq "bycoord") {
Note: See TracChangeset for help on using the changeset viewer.