pf-tools/pf-tools: detect ip not defined

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Jul 25 14:49:01 UTC 2014


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/fa231f529fdb
changeset: 1281:fa231f529fdb
user:      shad
date:      Fri Jul 25 16:48:54 2014 +0200
description:
detect ip not defined

diffstat:

 TODO                     |   1 +
 lib/PFTools/Conf/Host.pm |  33 +++++++++++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diffs (61 lines):

diff -r 64b55e4037e6 -r fa231f529fdb TODO
--- a/TODO	Mon May 12 12:49:52 2014 +0200
+++ b/TODO	Fri Jul 25 16:48:54 2014 +0200
@@ -54,6 +54,7 @@
 NH Variables dans private-network (ex %KERNEL_LVS%)
 NH Outils reseaux: Listes occupation vlans, graphes, detection libres
    contigues
+NM definition de la table de partitionnement dans pf-tool (generer la partie partman)
 
 Spécifique pf-host :
 
diff -r 64b55e4037e6 -r fa231f529fdb lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm	Mon May 12 12:49:52 2014 +0200
+++ b/lib/PFTools/Conf/Host.pm	Fri Jul 25 16:48:54 2014 +0200
@@ -852,18 +852,24 @@
 
         my $subnet_ref = get_subnet_from_vlan( $ip_type, $vlan_ref );
 
-        $result->{$ip_type} = __get_host_real_ip(
-            {   ip_type          => $ip_type,
-                host_number      => $host_number,
-                link_section_ref => $link_section_ref,
-                hostnum          => $hostnum,
-                hostnode         => $hostnode,
-                nodes            => $nodes,
-                subnet_ref       => $subnet_ref,
-                site_name        => $site_name,
-                site_ref         => $site_ref,
-            }
-        );
+        eval {
+            $result->{$ip_type} = __get_host_real_ip(
+                {   ip_type          => $ip_type,
+                    host_number      => $host_number,
+                    link_section_ref => $link_section_ref,
+                    hostnum          => $hostnum,
+                    hostnode         => $hostnode,
+                    nodes            => $nodes,
+                    subnet_ref       => $subnet_ref,
+                    site_name        => $site_name,
+                    site_ref         => $site_ref,
+                }
+            );
+        };
+        if ($EVAL_ERROR) {
+            croak
+                qq{ERROR: No $ip_type defined for $hostname on $iface_name (vlan: $vlan_name)};
+        }
 
         my $suffix    = get_suffix_from_ip_type($ip_type);
         my $route_key = '@route' . $suffix;
@@ -947,6 +953,9 @@
     my $param_nodes
         = $link_section_ref->{$ip_type_dot_host_number} ? 0 : $nodes;
 
+    if ( !$ipstart ) {
+        croak qq{ERROR: No $ip_type defined};
+    }
     my $params_ref = {
         ip_type    => $ip_type,
         subnet_ref => $subnet_ref,



More information about the pf-tools-commits mailing list