<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I have been working on a cobbler dns zone factory trigger, which
populates zone files according to a customizable regex-based
hostname-ip-mapping setting.<br>
<br>
The trigger is very basic now and uses static settings.  Essentially it
<br>
<br>
<ul>
  <li>Checks to see whether the hostname is valid.</li>
  <ul>
    <li>This is done by means of a modifiable regex-based function.</li>
  </ul>
  <li>The hostname is converted to an IP address</li>
  <ul>
    <li>This is done by means of a modifiable regex-based function.</li>
  </ul>
  <li>Forward/Reverse DNS zone templates are cheetahfied and written to
a zone directory.<br>
  </li>
</ul>
<br>
Unfortunately, cobbler does two things that limit certain this kind of
DNS trigger:<br>
<br>
<ol>
  <li>The 'syncing' occurs prior to the call of this trigger (and, I
would gather, all triggers).</li>
  <ul>
    <li>This prohibits custom checks for a valid --name, among other
arguments, before the actual sync should occur.</li>
    <ul>
      <li>Basically, the cobbler check that I've traced (as show below
in the get_pxe_filename definition) determines whether the --name is a
valid MAC address or IP address (the actual checking functions found in
utils.py) OR whether the --name is a resolveable hostname.</li>
    </ul>
    <li>Custom checks are a good idea, because they promote moving
policy to trigger-space.<br>
    </li>
  </ul>
  <li>The check on 'resolveable hostnames'</li>
  <ul>
    <li>This prevents modifications to zone files in triggers.</li>
    <ul>
      <li>If the zone file(s) targeted for modification during the
trigger mechanism do not possess name entries for the targeted systems
(corresponding to system --name), cobbler will complain that --name
does not resolve, and one receives an exception.</li>
    </ul>
  </ul>
</ol>
My problem is that, by (2) I cannot implement my trigger at all without
modifying cobbler source code (to allow unresolvable names as argument
for system adds).  If I were to modify the source code accordingly, I
find the deeper problem (1), where although my custom check may
prohibit a certain kind of hostname from being added to DNS, the system
is *still* added, since syncing occurs prior to the call to the trigger.<br>
<br>
This is an architectural question, which has strong bearing on the
development of triggers, and a philosophical question as to whether
policy ought to be pushed out to the triggers.<br>
<br>
What would the best short-term approach to resolving this problem be? 
I appreciate your time.<br>
<br>
--BEGIN action_sync.py SNIPPER--<br>
def get_pxe_filename(self,name_input):<br>
        """<br>
        The configuration file for each system pxe uses is either<br>
        a form of the MAC address of the hex version of the IP.  Not
sure<br>
        about ipv6 (or if that works).  The system name in the config
file<br>
        is either a system name, an IP, or the MAC, so figure it out,
resolve<br>
        the host if needed, and return the pxe directory name.<br>
        """<br>
        if name_input == "default":<br>
            return "default"<br>
        name = utils.find_system_identifier(name_input)<br>
        if utils.is_ip(name):<br>
            return utils.get_host_ip(name)<br>
        elif utils.is_mac(name):<br>
            return "01-" + "-".join(name.split(":")).lower()<br>
        else:<br>
            raise cexceptions.CobblerException("err_resolv", name)<br>
--END action_sync.py SNIPPET--<br>
<br>
<br>
--Adam<br>
</body>
</html>