~ubuntu-branches/ubuntu/trusty/nordugrid-arc/trusty

« back to all changes in this revision

Viewing changes to src/utils/gridmap/nordugridmap

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2013-11-29 13:39:10 UTC
  • mfrom: (3.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20131129133910-sy6ayoavphc5hozs
Tags: 4.0.0-1
4.0.0 Release (Closes: #715131) (LP: #1049798)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
use XML::DOM;
14
14
use LWP::UserAgent;
15
15
use LWP::Protocol::https;
16
 
use File::Temp;
 
16
use File::Temp qw(tempfile);
17
17
use File::Path;
18
18
use Storable;
19
19
use SOAP::Lite;
583
583
 
584
584
    foreach my $mapfile ( keys %$ref_mapfile_data ) {
585
585
        unless ( $dryrun ) {
586
 
            my $tmp_mapfile = $mapfile . "_tmp";
587
 
            open (GMF, "> $tmp_mapfile") or &Logger("Cannot open file for writting: $tmp_mapfile", FATAL);
 
586
            my ($gmf, $tmp_mapfile) = tempfile($mapfile . "XXXXX", UNLINK => 1) or 
 
587
                &Logger("Cannot open temporary file to write $mapfile data", FATAL);
588
588
 
589
 
            &Logger("Writting mapfile content for $mapfile", INFO);
 
589
            &Logger("Writting mapfile data for $mapfile", INFO);
590
590
 
591
591
            while ( my ($dn, $map) = each(%{$ref_mapfile_data->{$mapfile}}) ) {
592
 
                print GMF "\"$dn\" $map\n";
 
592
                print $gmf "\"$dn\" $map\n" or &Logger("Failed to write gridmap data (not enough disk space?) to $tmp_mapfile", FATAL);
593
593
            }
594
594
 
595
 
            close(GMF);
 
595
            close($gmf);
596
596
            rename $tmp_mapfile, $mapfile;
597
597
        } else {
598
598
            my $gmf_string = "";