- Timestamp:
- May 18, 2008 1:17:57 PM (17 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- bd6e48a
- Parents:
- 387408b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/splitter.pl
r387408b rad5639c 457 457 } 458 458 459 # Fill tbparams with results from the fedd call. The command is passed in and 460 # a string with any relevant error conditions is returned. undef is success. 461 sub fedd_access_request{ 462 my($cmd) = @_; 463 my($rv)=undef; 464 465 system("$cmd 2> /tmp/splitter.err.$$ > /tmp/splitter.$$" ); 466 467 if ( ! $? ) { 468 print "Parsing /tmp/splitter.$$\n"; 469 &parse_testbeds_filename("/tmp/splitter.$$", $tbparams) || 470 ($rv = "Error reading fedd output: $!\n"); 471 } 472 else { 473 my $f = new IO::File("/tmp/splitter.err.$$"); 474 $rv = "Fedd_client error:\n"; 475 while (<$f>) { $rv .= $_; } 476 $f->close(); 477 } 478 unlink("/tmp/splitter.$$", "/tmp/splitter.err.$$"); 479 return $rv; 480 } 459 481 460 482 $pid = $gid = "dummy"; # Default project and group to pass to … … 575 597 my @nodes; # Current testbed node requests 576 598 599 # The Allbeds line has the testbed name first separated by the node 600 # requirements of the testbeds. A node requirement is separated form 601 # teh testbed name and other node requirements by a vertical bar (|). 602 # This pulls the testbed off the front (which must be present) and 603 # splits the node descriptors out by the vertical bar. The first 604 # vertical bar (the one after the testbed) is removed by the intial 605 # regular expression to avoid a null entry in @nodes. The node 606 # requests are of the form image:type:count and can be passed directly 607 # to fedd_client as parameters. 577 608 /([^|]+)\|?(.*)/ && do { 578 my $n; 609 my $n; # Scratch 579 610 580 611 ($tb , $n) = ($1, $2); … … 588 619 die "Can't open pipe to fedd:$!\n"; 589 620 my $proj = $auth_proj ? " -p $auth_proj " : ""; 621 my @cmds; 622 my $rv; 590 623 591 624 print("Checking access to $tb using " . $tbparams->{$tb}->{'uri'} 592 625 . "\n") if $verbose; 593 626 594 my $cmd = "$fedd_client -t " . 627 # First access command, implicitly uses localhost fedd 628 push(@cmds,"$fedd_client -t " . 595 629 $tbparams->{$tb}->{'uri'} . " -T $ENV{HOME}/cacert.pem ". 596 630 "-l $tb $proj" . (@nodes ? " -n " : " ") . 597 join(" -n ", @nodes) . "| /usr/bin/tee fedd.$tb "; 598 print "$cmd\n" if $verbose; 599 600 $access_pipe->reader($cmd) || 601 die "Can't exec fedd_client: $!\n"; 602 603 &parse_testbeds($access_pipe, $tbparams) || 604 warn("Error reading fedd output: $!\n"); 605 $access_pipe->close(); 631 join(" -n ", @nodes)); 632 # Second try access command, implicitly directly contact testbed 633 push(@cmds,"$fedd_client -t " . 634 $tbparams->{$tb}->{'uri'} . " -u " . 635 $tbparams->{$tb}->{'uri'} . " -T $ENV{HOME}/cacert.pem ". 636 "-l $tb $proj" . (@nodes ? " -n " : " ") . 637 join(" -n ", @nodes)); 638 639 foreach my $c (@cmds) { 640 print "$c\n" if $verbose; 641 $rv = &fedd_access_request($c); 642 warn($rv) if $rv; 643 644 last if $rv eq undef; 645 } 646 die "Cannot get access to $tb\n" if $rv; 606 647 } 607 648 next;
Note: See TracChangeset
for help on using the changeset viewer.