On Mon, 2012-04-09 at 19:22 -0700, Nishanth Aravamudan wrote:
> Recent Cobbler (as of 741faeafc4782ee66d7d1934a29b107602f1ebe9 in the
> Cobbler git tree) only writes dhcpd.conf entries for netboot-enabled
> systems. When we mark a system as netboot_enabled, therefore, we need to
> also ensure dhcpd is synchronized, and there is a new API for this
> purpose.
>     
> Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com>
> 
> diff --git a/server/hosts/install_server.py b/server/hosts/install_server.py
> index 5eb4ae3..2c70766 100644
> --- a/server/hosts/install_server.py
> +++ b/server/hosts/install_server.py
> @@ -97,6 +97,14 @@ class CobblerInterface(object):
>              # reinstalled)
>              self.server.modify_system(system_handle, 'netboot_enabled', 
> 'True',
>                                        self.token)
> +            try:
> +                # Cobbler only generates the DHCP configuration for netboot 
> enabled
> +                # machines, so we need to synchronize the dhcpd file after 
> changing
> +                # the value above
> +                self.server.sync_dhcp(self.token)
> +            except Exception:
> +                # implies older Cobbler, where no action is necessary
> +                pass

^ Thinking about this change, the big problem here is that this remote
function might exist in cobbler and yet fail, so catching all exceptions
may not be a good idea. What would happen if sync_dhcp call actually
fails? Besides, we can verify which type of exception this code throws
by firing up a python interactive prompt, import xmlrpc and start
playing with it. I might do that tomorrow.

>              # Now, let's just restart the machine (machine has to have
>              # power management data properly set up).
>              self.server.save_system(system_handle, self.token)
> 


_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to