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:

^ Ok, this could be rewritten as:

        except xmlrpclib.Fault, err:
                logging.error("DHCP reload failed, error code: %s, error 
string: %s", err.faultCode, err.faultString)

To make sure you ignore 'unknown remote method' error strings and not
other errors, you could do some verification of the faultString and act
accordingly.

> +                # implies older Cobbler, where no action is necessary
> +                pass
>              # 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