Changeset 1164

Show
Ignore:
Timestamp:
06/30/08 12:09:21 (6 months ago)
Author:
mstauber
Message:

[1.1.0-82BQ19] Reworked OpenVZ provisions in constructor/40_addGateway.pl to set default OpenVZ gateway if it's missing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 5106R/trunk/ui/base-network.mod/Makefile

    r1146 r1164  
    88 
    99VERSION=1.1.0 
    10 RELEASE=82BQ18 
     10RELEASE=82BQ19 
    1111 
    1212# add a buildarch if desired 
  • 5106R/trunk/ui/base-network.mod/constructor/40_addGateway.pl

    r1146 r1164  
    3434    open(CONF, $conf) || die "Can't read configfile: $conf\n"; 
    3535    while (<CONF>) { 
    36         next unless /^GATEWAY=\s*(\S+)/; 
    37         if (! -f "/proc/user_beancounters") { 
    38                 $gateway = $1; 
    39         } 
    40         else { 
    41                 $gateway = "192.0.2.1"; 
    42         } 
     36        if (! -f "/proc/user_beancounters") {  
     37                next unless /^GATEWAY=\s*(\S+)/; 
     38        } 
     39        else { 
     40                next unless /^GATEWAY=\"(.*)\"/; 
     41        } 
     42        $gateway = $1; 
    4343    } 
    4444} 
     
    4747if (!$gateway) { 
    4848    $DEBUG && print STDERR "Gateway setting isn't found\n"; 
    49     my $data = `$Network::ROUTE -n|grep '^0\.0\.0\.0'`; 
    50     if ($data =~ /0\.0\.0\.0\s+((\d+).(\d+).(\d+).(\d+))/) { 
    51         $gateway = $1; 
     49    if ( ! -f "/proc/user_beancounters" ) { 
     50        my $data = `$Network::ROUTE -n|grep '^0\.0\.0\.0'`; 
     51        if ($data =~ /0\.0\.0\.0\s+((\d+).(\d+).(\d+).(\d+))/) { 
     52                $gateway = $1; 
     53        } 
     54    } 
     55    else { 
     56        # Set default OpenVZ gateway: 
     57        $gateway = "192.0.2.1"; 
     58        system("/bin/cat /etc/sysconfig/network |/bin/grep -v ^GATEWAY > /etc/sysconfig/network.bak"); 
     59        system("/bin/mv /etc/sysconfig/network.bak /etc/sysconfig/network"); 
     60        system("/bin/echo GATEWAY=\"192.0.2.1\" >> /etc/sysconfig/network"); 
     61        system("/etc/init.d/network restart > /dev/null"); 
    5262    } 
    5363} 
  • 5106R/trunk/ui/base-network.mod/templates/rpmdefs.tmpl

    r1146 r1164  
    103103<begin $CHANGELOG> 
    104104 
    105 * Sat Jul 07 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ18 
     105* Sun Jun 29 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ19 
     106- Reworked OpenVZ provisions in constructor/40_addGateway.pl to set default OpenVZ gateway if it's missing. 
     107 
     108* Sat Jun 07 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ18 
    106109- Reworked OpenVZ provisions in constructor/30_addNetwork.pl constructor/40_addGateway.pl 
    107110 
    108 * Fri Jul 06 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ17 
     111* Fri Jun 06 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ17 
    109112- Fixed handler rewrite-ifcfg.pl to not rewrite ifcfg-venet0 at all 
    110113 
    111 * Tue Jul 02 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ16 
     114* Tue Jun 02 2008 Michael Stauber <mstauber@solarspeed.net> 1.1.0-82BQ16 
    112115- Fully added OpenVZ provisions to all constructors, handlers, schemas and PHP pages. 
    113116