Author: eelco
Date: Sun Sep  4 18:04:47 2011
New Revision: 29007
URL: https://svn.nixos.org/websvn/nix/?rev=29007&sc=1

Log:
* In /etc/hosts, use the internal IPv4 address if available.  This is
  necessary in EC2 deployments (where the external address might be
  blocked by firewall rules).

Modified:
   cloud/trunk/src/nixos-deploy-network.pl

Modified: cloud/trunk/src/nixos-deploy-network.pl
==============================================================================
--- cloud/trunk/src/nixos-deploy-network.pl     Sun Sep  4 18:03:24 2011        
(r29006)
+++ cloud/trunk/src/nixos-deploy-network.pl     Sun Sep  4 18:04:47 2011        
(r29007)
@@ -191,7 +191,7 @@
 
 sub evalMachineInfo {
     my $machineInfoXML =
-        `nix-instantiate --eval-only --xml --strict --show-trace 
$myDir/eval-machine-info.nix --arg networkExprs '[ @networkExprs ]' -A 
machineInfo`;
+        `nix-instantiate --eval-only --show-trace --xml --strict --show-trace 
$myDir/eval-machine-info.nix --arg networkExprs '[ @networkExprs ]' -A 
machineInfo`;
     die "evaluation of @networkExprs failed" unless $? == 0;
     
     #print $machineInfoXML, "\n";
@@ -473,7 +473,11 @@
     foreach my $name (keys %{$spec->{machines}}) {
         my $machine = $state->{machines}->{$name};
         $hosts .= "$machine->{ipv6} $name\\n" if $machine->{ipv6};
-        $hosts .= "$machine->{ipv4} $name\\n" if $machine->{ipv4};
+        if (defined $machine->{privateIpv4}) {
+            $hosts .= "$machine->{privateIpv4} $name\\n";
+        } else {
+            $hosts .= "$machine->{ipv4} $name\\n" if $machine->{ipv4};
+        }
     }
     
     open STATE, ">physical.nix" or die;
_______________________________________________
nix-commits mailing list
nix-comm...@cs.uu.nl
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to