Hi,

I work aroun a little bit more now I have,

# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

#for dhcp_tag in $dhcp_tags.keys():
 #class for Cobbler DHCP tag: $dhcp_tag
 #if $dhcp_tags == "pxeclient"
        class "pxeclient" {
        match if option user-class = "pxeclient";
        }
 #end if
 #if $dhcp_tags = "mysql"
        class "mysql" {
        match if option user-class = "mysql";
        }
 #end if
 #if $dhcp_tags = "others"
        class "others" {
        match if option user-class = "others";
        }
 #end if

        subnet 192.168.57.0 netmask 255.255.255.0 {
        pool {
        allow members of "pxeclient";
        option routers 192.168.57.111;
        option domain-name-servers 8.8.8.8;
        option subnet-mask 255.255.255.0;
        range dynamic-bootp 192.168.57.200 192.168.57.254;
        filename "/pxelinux.0";
        default-lease-time 21600;
        max-lease-time 43200;
        next-server $next_server;
        }
        pool {
                allow members of "mysql";
                range 192.168.57.30 192.168.57.40;
                option routers 192.168.57.102;
             }
        pool {
                allow members of "others";
                range 192.168.57.50 192.168.57.100;
             }
        }
#end for

I am having this error when I run "cobbler sync";

rendering DHCP files
generating /etc/dhcp/dhcpd.conf
Exception occured: <class 'Cheetah.Parser.ParseError'>
Exception value:

Error in the Python code which Cheetah generated for this template:
================================================================================

invalid syntax (cheetah_DynamicallyCompiledCheetahTemplate_1371569049_44_94545.py, line 187)

Line|Python Code
----|-------------------------------------------------------------
\t}
186 |''')
           if VFFSL(SL,"dhcp_tags",True) = "mysql": # generated from line 70, col 2
                                              ^
 \tmatch if option user-class = "mysql";
\t}
190 |''')

================================================================================

Here is the corresponding Cheetah code:

Line 70, column 2

Line|Cheetah Code
----|-------------------------------------------------------------
      match if option user-class = "pxeclient";
    }
#end if
#if $dhcp_tags = "mysql"
      ^
     class "mysql" {
     match if option user-class = "mysql";
    }

Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 89, in run
    rc = self._run(self)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 184, in runner
    return self.remote.api.sync(self.options.get("verbose",False),logger=self.logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 699, in sync
    return sync.run()
   File "/usr/lib/python2.7/dist-packages/cobbler/action_sync.py", line 132, in run
    self.dhcp.write_dhcp_file()
   File "/usr/lib/python2.7/dist-packages/cobbler/modules/manage_isc.py", line 197, in write_dhcp_file
    self.templar.render(template_data, metadata, self.settings_file, None)
   File "/usr/lib/python2.7/dist-packages/cobbler/templar.py", line 128, in render
    t = Template(source=raw_data, errorCatcher="Echo", searchList=[search_table], compilerSettings={'useStackFrame':False})
   File "DynamicallyCompiledCheetahTemplate.py", line 58, in __init__
   File "_etc_cobbler_cheetah_macros.py", line 58, in __init__
   File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1259, in __init__
    self._compile(source, file, compilerSettings=compilerSettings)
   File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1553, in _compile
    keepRefToGeneratedCode=True)
   File "/usr/lib/python2.7/dist-packages/cobbler/template_api.py", line 127, in compile
    return Cheetah.Template.Template.compile(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 798, in compile
    raise parseError

!!! TASK FAILED !!!


So what am I doing wrong here?

Regards,



On Tue, Jun 18, 2013 at 5:02 PM, leo loe <lutphi82@gmail.com> wrote:
Hi Harry,

Actually I worked around that and I made a configuration which is probably wrong,

for dhcp_tag in $dhcp_tags.keys():
#user-class for Cobbler DHCP tag: $dhcp_tag
 #if $dhcp_tags=pxeclient
class "pxeclient" {
  match if option user-class = "pxeclient";
}
 #if $dhcp_tags=foo
  class "mysql" {
  match if option user-class = "foo";
}
 #end if
#if $dhcp_tags=bar
class "others" {
  match if option user-class = "bar";
}
 #end if

subnet 192.168.57.0 netmask 255.255.255.0 {
pool{
allow members of "pxeclient";
option routers 192.168.57.111;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.57.200 192.168.57.254;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.57.111;
}
   pool {
    allow members of "foo";
    range 192.168.57.30 192.168.57.40;
    option routers 192.168.57.102;
  }
  pool {
    allow members of "bar";
    range 192.168.57.50 192.168.57.100;
  }

}

Also I did the settings change manage_dhcp: 1 and no changes in /etc/dhcp/dhcpd.conf file. 

So what's wrong in here?


On Tue, Jun 18, 2013 at 4:02 PM, Harry Hoffman <hhoffman@ip-solutions.net> wrote:
Hi Leo,

Sure, you can.

Check out the template file /etc/cobbler/dhcp.template.

Define the subnets you are using above the line that starts:
#for dhcp_tag in $dhcp_tags.keys():

Then tell cobbler to manage dhcpd by setting manage_dhcp: 1  in
/etc/cobbler/settings.

Restart cobblerd and run cobbler sync. The dhcp.template will be
expanded to /etc/dhcp.conf on redhat > 6 and /etc/dhcp/dhcpd.conf on
redhat =< 6

Cheers,
Harry

On 06/18/2013 08:21 AM, leo loe wrote:
> Hi,
>
> I am newbie on cobblerd. I am curious if I can manage dhclient.conf with
> cobbler. I got many subnets in my network. For example I got a management
> network and project subnet. So my servers have at least two interfaces. Can
> i use cobbler to use for giving IP addresses both of those interfaces. So
> that
>
> eth0: x.x.x.x
> eth1: y:y:y:y
>
> and I can manage to that via dhclient.conf by using user-class option. But
> I don't know how to do this via cobbler by using dhcp_tag. Any ideas?
>
> Regards
>
>
>
> _______________________________________________
> cobbler mailing list
> cobbler@lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/cobbler
>
_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler