cohoe / starrs

System Technology Accounting and Resource Registration Solution
grantcohoe.com/projects/starrs
Other
16 stars 6 forks source link

DHCP classes not required #240

Open cohoe opened 11 years ago

cohoe commented 11 years ago

systems.interface_addresses.class needs to be NULL-able

@agargiulo: for dhcpgen, if(address.class is null) then (skip "subclass" lines for address)

agargiulo commented 11 years ago

would this fix it then?

diff --git a/API/plperl.sql b/API/plperl.sql
index 2c59205..be1a35f 100644
--- a/API/plperl.sql
+++ b/API/plperl.sql
@@ -267,8 +267,8 @@ CREATE OR REPLACE FUNCTION "api"."generate_dhcpd_config"() RETURNS VOID AS $$
                $output .= "  ddns-domainname \"$zone\";\n" if (defined($zone));
                $output .= "  option domain-name \"$zone\";\n" if (defined($zone));
                $output .= "}\n";
-               $output .= "subclass \"$class\" 1:$mac;\n";
-               $output .= "subclass \"$class\" $mac;\n\n";
+               $output .= "subclass \"$class\" 1:$mac;\n" if ($class != null);
+               $output .= "subclass \"$class\" $mac;\n\n" if ($class != null);
                return $output;
        }
agargiulo commented 11 years ago

Or is this better:

diff --git a/API/plperl.sql b/API/plperl.sql
index 2c59205..d1bbb99 100644
--- a/API/plperl.sql
+++ b/API/plperl.sql
@@ -267,8 +267,8 @@ CREATE OR REPLACE FUNCTION "api"."generate_dhcpd_config"() RETURNS VOID AS $$
                $output .= "  ddns-domainname \"$zone\";\n" if (defined($zone));
                $output .= "  option domain-name \"$zone\";\n" if (defined($zone));
                $output .= "}\n";
-               $output .= "subclass \"$class\" 1:$mac;\n";
-               $output .= "subclass \"$class\" $mac;\n\n";
+               $output .= "subclass \"$class\" 1:$mac;\n" if (defined($class));
+               $output .= "subclass \"$class\" $mac;\n\n" if (defined($class));
                return $output;
        }
agargiulo commented 11 years ago

Bump

cohoe commented 11 years ago

The problem is that I don't remember if there are other dependencies on DHCP classes. This hasn't been enough of a priority to look at.