On 07/12/2012 04:46 PM, Nishanth Aravamudan wrote:
> On 12.07.2012 [13:33:16 -0300], Cleber Rosa wrote:
>> On 07/12/2012 08:55 AM, Cleber Rosa wrote:
>>> On 07/12/2012 05:07 AM, Nishanth Aravamudan wrote:
>>>> On 12.07.2012 [00:20:04 -0700], Nishanth Aravamudan wrote:
>>>>> Hi all,
>>>>>
>>>>> After finally bothering to just put a proxy in place locally, I got
>>>>> grubby 8.15 to build, but it doesn't seem to make boottool happy :)
>>>>>
>>>>> 07/12 02:53:12 INFO |  boottool:0667| Installing grubby
>>>>> because currently installed version (8.11) is not recent
>>>>> enough
>>>>> 07/12 02:53:18 DEBUG|  boottool:0674| Installed: grubby version 8.15
>>>>> 07/12 02:53:18 ERROR|       job:1338| JOB ERROR: Unhandled
>>>>> TypeError: sequence item 0: expected string, NoneType found
>>>>> Traceback (most recent call last):
>>>>>    File "/usr/local/autotest/job.py", line 1089, in _run_step_fn
>>>>>      exec('__ret = %s(*__args, **__dargs)' % fn, local_vars,
>>>>> local_vars)
>>>>>    File "<string>", line 1, in <module>
>>>>>    File "/usr/local/autotest/control.autoserv", line 16, in boot_kernel
>>>>>      host.cleanup_kernels()
>>>>>    File "/usr/local/autotest/shared/hosts/base_classes.py",
>>>>> line 655, in cleanup_kernels
>>>>>      boot_info = self.bootloader.get_entries()
>>>>>    File "/usr/local/autotest/tools/boottool.py", line 1150, in
>>>>> get_entries
>>>>>      raw = self.get_info()
>>>>>    File "/usr/local/autotest/tools/boottool.py", line 1180, in get_info
>>>>>      info = self._run_grubby_get_output([command])
>>>>>    File "/usr/local/autotest/tools/boottool.py", line 835, in
>>>>> _run_grubby_get_output
>>>>>      return self._run_get_output(args)
>>>>>    File "/usr/local/autotest/tools/boottool.py", line 751, in
>>>>> _run_get_output
>>>>>      ' '.join(arguments))
>>>>> TypeError: sequence item 0: expected string, NoneType found
>>>>>
>>>>> 07/12 02:53:18 INFO |       job:0210| END ABORT    ---- ----
>>>>> timestamp=1342075998    localtime=Jul 12 02:53:18 Unhandled
>>>>> TypeError: sequence item 0: expected string, NoneType found
>>>>>    Traceback (most recent call last):
>>>>>      File "/usr/local/autotest/job.py", line 1089, in _run_step_fn
>>>>>        exec('__ret = %s(*__args, **__dargs)' % fn, local_vars,
>>>>> local_vars)
>>>>>      File "<string>", line 1, in <module>
>>>>>      File "/usr/local/autotest/control.autoserv", line 16, in
>>>>> boot_kernel
>>>>>        host.cleanup_kernels()
>>>>>      File "/usr/local/autotest/shared/hosts/base_classes.py",
>>>>> line 655, in cleanup_kernels
>>>>>        boot_info = self.bootloader.get_entries()
>>>>>      File "/usr/local/autotest/tools/boottool.py", line 1150,
>>>>> in get_entries
>>>>>        raw = self.get_info()
>>>>>      File "/usr/local/autotest/tools/boottool.py", line 1180,
>>>>> in get_info
>>>>>        info = self._run_grubby_get_output([command])
>>>>>      File "/usr/local/autotest/tools/boottool.py", line 835,
>>>>> in _run_grubby_get_output
>>>>>        return self._run_get_output(args)
>>>>>      File "/usr/local/autotest/tools/boottool.py", line 751,
>>>>> in _run_get_output
>>>>>        ' '.join(arguments))
>>>>>    TypeError: sequence item 0: expected string, NoneType found
>>>>>    07/12 02:53:18 DEBUG|  base_job:0349| Persistent state
>>>>> client._record_indent now set to 0
>>>> I won't claim to understand why it's happening, but I can tell a bit
>>>> more about what's happening:
>>>>
>>>> Adding some hacks locally to _run_grubby_get_output, to print out the
>>>> parameter arguments and the prepared return value args, I get:
>>>>
>>>> 04:01:35 INFO | Writing results to /usr/local/autotest/results/default
>>>> 04:01:35 INFO | START   ----    ----    timestamp=1342080095
>>>> localtime=Jul 12 04:01:35
>>>> 04:01:36 INFO | arguments :  ['--info=ALL']
>>>> 04:01:36 INFO | self.path =  None
>>>> 04:01:36 INFO | arguments :  ['--version']
>>>> 04:01:36 INFO | self.path =  /sbin/grubby
>>>> 04:01:36 INFO | args :  ['/sbin/grubby', '--version']
>>>> 04:01:36 INFO | arguments :  ['--version']
>>>> 04:01:36 INFO | self.path =  /sbin/grubby
>>>> 04:01:36 INFO | args :  ['/sbin/grubby', '--version']
>>>> 04:01:36 INFO | arguments :  ['--version']
>>>> 04:01:36 INFO | self.path =  /sbin/grubby
>>>> 04:01:36 INFO | args :  ['/sbin/grubby', '--version']
>>>> 04:01:36 INFO | args :  [None, '--grub2', '--info=ALL']
>>>> 04:01:36 ERROR| JOB ERROR: Unhandled TypeError: sequence item 0:
>>>> expected string, NoneType found
>>>>
>>>> So a couple of questions come to mind:
>>>>
>>>> 1) why do we call --version so many times?
>>> There's certainly room for optimizations here.
>>>
>>>> 2) AFAICT from my debugging, this is all coming from the one call to
>>>> get_info(), but I don't see how self.path can be None.
>>> I've seen the same error when I had two grub entries with the same
>>> kernel and parameters set. I'm *guessiing* this is related to it,
>>> as your configuration also seems to be like that. I'm debugging
>>> that right now and will let you know about it.
>> Nish,
>>
>> My first guess was actually incorrect. I've identified that the
>> error is related to the laziness of the client/shared/boottool.py
>> code when instantiating boottool, which inherits from Grubby.
>>
>> I've switched from the lazy approach to simply importing Grubby as
>> boottool from the boottool_cli module:
>>
>> from boottool_cli import Grubby as boottool
>>
>> and the error ceases to exist.
>>
>> I'm working on fixing that now.
> Something like the following?
>
> diff --git a/client/shared/boottool.py b/client/shared/boottool.py
> index 90f936b..05858d6 100644
> --- a/client/shared/boottool.py
> +++ b/client/shared/boottool.py
> @@ -29,30 +29,4 @@ except ImportError:
>   
>   
>   imp.load_source("boottool_cli", BOOTTOOL_CLI_PATH)
> -from boottool_cli import Grubby, install_grubby_if_necessary, EfiToolSys
> -
> -
> -class boottool(Grubby):
> -    """
> -    Client site side boottool wrapper.
> -
> -    Inherits all functionality from boottool(.py) CLI app (lazily).
> -    """
> -    def __init__(self, path='/sbin/grubby'):
> -        self.instantiated = False
> -        self.path = path
> -
> -
> -    def _init_on_demand(self):
> -        if not self.instantiated:
> -            try:
> -                install_grubby_if_necessary()
> -                Grubby.__init__(self, self.path)
> -                self.instantiated = True
> -            except Exception, e:
> -                raise error.JobError("Unable to instantiate boottool: %s" % 
> e)
> -
> -
> -    def __getattr__(self, name):
> -        self._init_on_demand()
> -        return Grubby.__getattribute__(self, name)
> +from boottool_cli import Grubby as boottool, install_grubby_if_necessary, 
> EfiToolSys
>
> This also seems to be working here.

Yes, exactly.

But the lazy instantiation was done on purpose, and we may not be able 
to get rid of it that easily. I'm doing some experimentation here to 
think about the best approach.

Cheers,
CR.

> Thanks,
> Nish
>


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

Reply via email to