Re: [PATCH 1/2] Add a script mode that exits instead of looping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-12-16 at 10:54 -0800, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl@xxxxxxxxxx>
> 
> Instead of falling into an infinite loop like cmdline raise an error
> with a useful description of the problem. Select it with -S or --script
> 
> This removes the infinite loops from cmdline mode, allowing it to
> be subclassed for use with either cmdline or script mode.

I have one recurring complaint, below.

> ---
>  anaconda               |   14 +++++++--
>  pyanaconda/__init__.py |    3 ++
>  pyanaconda/cmdline.py  |   75 ++++++++++++++++++++----------------------------
>  pyanaconda/script.py   |   52 +++++++++++++++++++++++++++++++++
>  4 files changed, 97 insertions(+), 47 deletions(-)
>  create mode 100644 pyanaconda/script.py
> 
> diff --git a/anaconda b/anaconda
> index d8e9de5..ee8fe49 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -197,6 +197,7 @@ def parseOptions(argv = None):
>                    default="g")
>      op.add_option("-G", "--graphical", dest="display_mode", action="store_const", const="g")
>      op.add_option("-T", "--text", dest="display_mode", action="store_const", const="t")
> +    op.add_option("-S", "--script", dest="display_mode", action="store_const", const="s")
>  
>      # Network
>      op.add_option("--noipv4", action="store_true", default=False)
> @@ -381,7 +382,7 @@ def check_memory(anaconda, opts, display_mode=None):
>          sys.exit(1)
>  
>      # override display mode if machine cannot nicely run X
> -    if display_mode not in ('t', 'c') and not flags.usevnc:
> +    if display_mode not in ('t', 'c', 's') and not flags.usevnc:
>          needed_ram += int(isys.GUI_INSTALL_EXTRA_RAM / 1024)
>          reason = reason_graphical
>  
> @@ -489,8 +490,9 @@ def setupDisplay(anaconda, opts):
>          # now determine if we're going to run in GUI or TUI mode
>          #
>          # if no X server, we have to use text mode
> -        if not flags.livecdInstall and not iutil.isS390() and \
> -           not os.access("/usr/bin/Xorg", os.X_OK):
> +        if anaconda.displayMode == 'g' and not flags.livecdInstall \
> +           and not iutil.isS390() \
> +           and not os.access("/usr/bin/Xorg", os.X_OK):
>               stdoutLog.warning(_("Graphical installation is not available. "
>                                   "Starting text mode."))
>               time.sleep(2)
> @@ -814,5 +816,11 @@ if __name__ == "__main__":
>          anaconda.dispatch.run()
>      except SystemExit, code:
>          exitHandler(anaconda, code)
> +    except RuntimeError, errtxt:

It would be nice if you replaced all the 'except Error, foo' with
'except Error as foo'. Likewise, when raising the errors, 'raise
Error(foo)' is much clearer than 'raise Error, foo'.

Dave


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux