Changeset 1295

Show
Ignore:
Timestamp:
08/28/07 12:36:35 (4 years ago)
Author:
jo
Message:

Managed to check in broken version. Fixed so it works again.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/jo/multilevel-groups/server/munin-update.in

    r1294 r1295  
    382382    my $val    = shift; 
    383383 
    384     logger ("INFO: Changing type of $ofile to " . (defined $val?$val:"GAUGE")); 
    385     RRDs::tune ($ofile, "-d", "42:".(defined $val?$val:"GAUGE")); 
    386  
    387     logger ("INFO: Changing name of $ofile to $nfile"); 
    388     unless (rename ($ofile, $nfile)) { 
    389         logger ("ERROR: Could not rename file: $!\n"); 
    390     } 
     384    if (defined $ofile and -f $ofile) { 
     385        logger ("INFO: Changing name of $ofile to $nfile"); 
     386        unless (rename ($ofile, $nfile)) { 
     387            logger ("ERROR: Could not rename file: $!\n"); 
     388        } 
     389    } 
     390 
     391    logger ("INFO: Changing type of $nfile to " . (defined $val?$val:"GAUGE")); 
     392    RRDs::tune ($nfile, "-d", "42:".(defined $val?$val:"GAUGE")); 
    391393} 
    392394 
     
    448450        my @tmp = ($$, munin_get_node_loc($newconf), $name); 
    449451        if (ref $oldconf) { 
    450           munin_copy_node_toloc ($oldnode, $newconf, []); 
     452          copy_node ($oldconf, $newconf); 
    451453          nstore_fd \@tmp, \*SOCK || die "Could not nstore_fd: $!"; 
    452454          nstore_fd \%{munin_get_separated_node ($newconf)}, \*SOCK; 
     
    492494        # If we can't reach the client. Using old Configuration. 
    493495        if (ref $oldconf) { 
    494           munin_copy_node_toloc ($oldnode, $newconf, []); 
     496          copy_node ($oldconf, $newconf); 
    495497          alarm (0); # Don't want to interrupt this. 
    496498          socket (SOCK, PF_UNIX, SOCK_STREAM, 0)   || die "socket: $!"; 
     
    508510                my $ctx; 
    509511                if (!config_node($newconf,$oldconf,$socket)) { 
    510                     munin_copy_node_toloc ($oldnode, $newconf, []); 
     512                    copy_node ($oldconf, $newconf); 
    511513                    socket (SOCK, PF_UNIX, SOCK_STREAM, 0)   || die "socket: $!"; 
    512514                    connect (SOCK, sockaddr_un (munin_get($newconf, "rundir")."/$serversocket")) || die "connect: $!"; 
     
    536538        # If we can't reach the client. Using old Configuration. 
    537539        if (ref $oldconf) { 
    538             munin_copy_node_toloc ($oldnode, $newconf, []); 
     540            copy_node ($oldconf, $newconf); 
    539541        } 
    540542      } else { 
     
    915917        logger ("Error: Could not get list from $newconf->{address}: $!\nAttempting to use old configuration"); 
    916918        if (ref $oldconf) { 
    917             munin_copy_node_toloc ($oldnode, $newconf, []); 
     919            copy_node ($oldconf, $newconf); 
    918920        } 
    919921        @services = []; 
     
    941943                if ($oldconf->{$servname}) { 
    942944                    logger("Attempting to use old configuration"); 
    943                     munin_copy_node_toloc ($oldconf->{$servname}, $newconf, [$servname]); 
     945                    copy_node ($newconf->{$servname}, $oldconf->{$servname}); 
    944946                } else { 
    945947                    logger("Skipping configuration of $servname"); 
     
    11441146} 
    11451147 
     1148sub copy_node 
     1149{ 
     1150    my $from = shift; 
     1151    my $to   = shift; 
     1152     
     1153    if (ref ($from) eq "HASH") { 
     1154        foreach my $key (keys %$from) { 
     1155            next if $key =~ /^#%#/; 
     1156            $to->{$key} = $from->{$key}; 
     1157        } 
     1158    } else { 
     1159        $to = $from; 
     1160    } 
     1161    return $to; 
     1162} 
     1163 
    114611641; 
    11471165