On Wed, Jul 11, 2012 at 9:38 PM, Nishanth Aravamudan
<n...@linux.vnet.ibm.com> wrote:
> When we are running repair on a system, we aren't passed a profile like
> we are with autoserv jobs normally in the machine name. So self.profile
> for the Host object comes back as ''. With the code as-is, that will
> result in install_machine() returning immediately back to the repair
> code and verify complaining with:
>
> 07/08 06:45:32 INFO |base_class:0407| Trying to reinstall the machine
> 07/08 06:45:32 WARNI|base_class:0360| Already done this (<bound method 
> [machine name redacted].machine_install of <remote host: [machine name 
> redacted], profile: >>) repair procedure, re-raising the original exception.
>
> I think a simpler choice is that if we still don't have a profile after
> self.profile is assigned, let's assume that the install system can
> figure it out? And if it is unable to (usually do to a misconfiguration
> of Cobbler backend), thrown an exception.

Ok Nish, this looks good to me, so I've applied to next.

Thanks!

> Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com>
>
> diff --git a/client/shared/error.py b/client/shared/error.py
> index aac3c5a..cf7793a 100644
> --- a/client/shared/error.py
> +++ b/client/shared/error.py
> @@ -348,6 +348,13 @@ class HostInstallTimeoutError(JobError):
>      pass
>
>
> +class HostInstallProfileError(JobError):
> +    """
> +    Indicates the machine failed to have a profile assigned.
> +    """
> +    pass
> +
> +
>  class AutotestHostRunError(HostRunErrorMixIn, AutotestError):
>      pass
>
> diff --git a/server/hosts/install_server.py b/server/hosts/install_server.py
> index bfa8503..7ede52c 100644
> --- a/server/hosts/install_server.py
> +++ b/server/hosts/install_server.py
> @@ -110,8 +110,11 @@ class CobblerInterface(object):
>              timeout = 3600
>
>          system, system_handle = self.get_system_handle(host)
> -        if profile:
> +        if not profile:
>              profile = self.server.get_system(system).get('profile')
> +        if not profile:
> +            e_msg = 'Unable to determine profile for host %s' % host.hostname
> +            raise error.HostInstallProfileError(e_msg)
>
>          host.record("START", None, "install", host.hostname)
>          host.record("GOOD", None, "install.start", host.hostname)
> diff --git a/server/hosts/remote.py b/server/hosts/remote.py
> index 6b14bd2..29d6033 100644
> --- a/server/hosts/remote.py
> +++ b/server/hosts/remote.py
> @@ -87,7 +87,7 @@ class RemoteHost(base_classes.Host):
>          if install_server_is_configured():
>              if not profile:
>                  profile = self.profile
> -            if not profile or profile == 'Do_not_install':
> +            if profile == 'Do_not_install':
>                  return
>              num_attempts = int(server_info.get('num_attempts', 2))
>              ServerInterface = 
> self.INSTALL_SERVER_MAPPING[server_info['type']]
>
> --
> Nishanth Aravamudan <n...@us.ibm.com>
> IBM Linux Technology Center
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



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

Reply via email to