On Thu, 2011-04-07 at 23:56 -0300, Lucas Meneghel Rodrigues wrote:
> From Fedora 15 onwards, the init system will be systemd, which for
> some reason ships with an /etc/inittab file but no actual content on
> it, just some explanation of how things work with systemd. This
> config will break harness_standalone, which is hoping to get a runlevel
> from that file.
> 
> So, extend the checks made to include looking for /etc/systemd, and if
> that path exists, assume the default runlevel is the runlevel we are in
> and get info from the runlevel program output. This makes the client
> to work again on F15.

What about this one guys? I understand eventually we'll need to come up
with a better thought logic with regards to detecting init systems and
taking the appropriate measures, but honestly I was tired and just
wanted to fix the bug on my newly installed F15 box...

> Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
> ---
>  client/bin/harness_standalone.py |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/client/bin/harness_standalone.py 
> b/client/bin/harness_standalone.py
> index 75a2da9..c4b7f26 100644
> --- a/client/bin/harness_standalone.py
> +++ b/client/bin/harness_standalone.py
> @@ -5,7 +5,7 @@ The default interface as required for the standalone reboot 
> helper.
>  
>  __author__ = """Copyright Andy Whitcroft 2007"""
>  
> -from autotest_lib.client.common_lib import utils
> +from autotest_lib.client.common_lib import utils, error
>  import os, harness, shutil, logging
>  
>  class harness_standalone(harness.harness):
> @@ -32,11 +32,14 @@ class harness_standalone(harness.harness):
>  
>          logging.info('Symlinking init scripts')
>          rc = os.path.join(self.autodir, 'tools/autotest')
> -        # see if system supports event.d versus inittab
> -        if os.path.exists('/etc/event.d'):
> +        # see if system supports event.d versus systemd versus inittab
> +        supports_eventd = os.path.exists('/etc/event.d')
> +        supports_systemd = os.path.exists('/etc/systemd')
> +        supports_inittab = os.path.exists('/etc/inittab')
> +        if supports_eventd or supports_systemd:
>              # NB: assuming current runlevel is default
>              initdefault = utils.system_output('/sbin/runlevel').split()[1]
> -        elif os.path.exists('/etc/inittab'):
> +        elif supports_inittab:
>              initdefault = utils.system_output('grep :initdefault: 
> /etc/inittab')
>              initdefault = initdefault.split(':')[1]
>          else:


_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to