My commit 5634449a1645343f3be340aa39faebdd5436ab35 causes that the TUI ProgressHub is not scheduled/run because it provides no spokes and the result is that the actual installation is skipped, because it is triggered by the hub. There are two ways how to fix this issue: 1. always schedule the TUI ProgressHub 2. make ProgressHub a standalone spoke
I'm for 2. because the ProgressHub really is not a hub. It outputs a lot of text to the standard output and thus it cannot provide any spokes as those would be rolled off soon after the installation begins. However, 1. is much shorter and probably less invasive.
The progress screen in text mode is not a hub. It cannot provide any spokes because it prints a lot of text to the output and spokes would be rolled off in a moment. It should be a standalone spoke which also fixes the issue with it not being scheduled because of no spokes to be provided.
Resolves: rhbz#1008788
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/hubs/progress.py | 131 -------------------------------- pyanaconda/ui/tui/spokes/progress.py | 140 +++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 131 deletions(-) delete mode 100644 pyanaconda/ui/tui/hubs/progress.py create mode 100644 pyanaconda/ui/tui/spokes/progress.py
diff --git a/pyanaconda/ui/tui/hubs/progress.py b/pyanaconda/ui/tui/hubs/progress.py deleted file mode 100644 index 82ad263..0000000 --- a/pyanaconda/ui/tui/hubs/progress.py +++ /dev/null @@ -1,131 +0,0 @@ -# Text progress hub classes -# -# Copyright (C) 2012 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, -# modify, copy, or redistribute it subject to the terms and conditions of -# the GNU General Public License v.2, or (at your option) any later version. -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY expressed or implied, including the implied warranties of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. You should have received a copy of the -# GNU General Public License along with this program; if not, write to the -# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the -# source code or documentation are not subject to the GNU General Public -# License and may only be used or replicated with the express permission of -# Red Hat, Inc. -# -# Red Hat Author(s): Jesse Keating jkeating@redhat.com -# - -import sys - -from pyanaconda.flags import flags -from pyanaconda.i18n import _ -from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION -from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT - -from pyanaconda.ui.tui.hubs import TUIHub -from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops - -__all__ = ["ProgressHub"] - -class ProgressHub(TUIHub): - title = _("Progress") - - def __init__(self, app, ksdata, storage, payload, instclass): - TUIHub.__init__(self, app, ksdata, storage, payload, instclass) - self._stepped = False - - def _update_progress(self): - """Handle progress updates from install thread.""" - - from pyanaconda.progress import progressQ - import Queue - - q = progressQ.q - - # Grab all messages may have appeared since last time this method ran. - while True: - # Attempt to get a message out of the queue for how we should update - # the progress bar. If there's no message, don't error out. - # Also flush the communication Queue at least once a second and - # process it's events so we can react to async evens (like a thread - # throwing an exception) - while True: - try: - (code, args) = q.get(timeout = 1) - break - except Queue.Empty: - pass - finally: - self.app.process_events() - - if code == progressQ.PROGRESS_CODE_INIT: - # Text mode doesn't have a finite progress bar - pass - elif code == progressQ.PROGRESS_CODE_STEP: - # Instead of updating a progress bar, we just print a pip - # but print it without a new line. - sys.stdout.write('.') - sys.stdout.flush() - # Use _stepped as an indication to if we need a newline before - # the next message - self._stepped = True - elif code == progressQ.PROGRESS_CODE_MESSAGE: - # This should already be translated - if self._stepped: - # Get a new line in case we've done a step before - self._stepped = False - print('') - print(args[0]) - elif code == progressQ.PROGRESS_CODE_COMPLETE: - # There shouldn't be any more progress updates, so return - q.task_done() - - - if self._stepped: - print('') - return True - elif code == progressQ.PROGRESS_CODE_QUIT: - sys.exit(args[0]) - - q.task_done() - return True - - def refresh(self, args = None): - from pyanaconda.install import doInstall, doConfiguration - from pyanaconda.threads import threadMgr, AnacondaThread - - # We print this here because we don't really use the window object - print(self.title) - - threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall, - args=(self.storage, self.payload, self.data, - self.instclass))) - - # This will run until we're all done with the install thread. - self._update_progress() - - threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration, - args=(self.storage, self.payload, self.data, - self.instclass))) - - # This will run until we're all done with the configuration thread. - self._update_progress() - - # kickstart install, continue automatically if reboot or shutdown selected - if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]: - # Just pretend like we got input, and our input doesn't care - # what it gets, it just quits. - self.input(None, None) - - return True - - def prompt(self, args = None): - return(_("\tInstallation complete. Press return to quit")) - - def input(self, args, key): - # There is nothing to do here, just raise to exit the hub - raise ExitAllMainLoops() diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py new file mode 100644 index 0000000..44adb43 --- /dev/null +++ b/pyanaconda/ui/tui/spokes/progress.py @@ -0,0 +1,140 @@ +# Text progress hub classes +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Jesse Keating jkeating@redhat.com +# + +import sys + +from pyanaconda.flags import flags +from pyanaconda.i18n import _ +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION +from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT + +from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops + +__all__ = ["ProgressSpoke"] + +class ProgressSpoke(StandaloneTUISpoke): + title = _("Progress") + + postForHub = SummaryHub + priority = 0 + + def __init__(self, app, ksdata, storage, payload, instclass): + StandaloneTUISpoke.__init__(self, app, ksdata, storage, payload, instclass) + self._stepped = False + + @property + def completed(self): + # this spoke is never completed, initially + return False + + def _update_progress(self): + """Handle progress updates from install thread.""" + + from pyanaconda.progress import progressQ + import Queue + + q = progressQ.q + + # Grab all messages may have appeared since last time this method ran. + while True: + # Attempt to get a message out of the queue for how we should update + # the progress bar. If there's no message, don't error out. + # Also flush the communication Queue at least once a second and + # process it's events so we can react to async evens (like a thread + # throwing an exception) + while True: + try: + (code, args) = q.get(timeout = 1) + break + except Queue.Empty: + pass + finally: + self.app.process_events() + + if code == progressQ.PROGRESS_CODE_INIT: + # Text mode doesn't have a finite progress bar + pass + elif code == progressQ.PROGRESS_CODE_STEP: + # Instead of updating a progress bar, we just print a pip + # but print it without a new line. + sys.stdout.write('.') + sys.stdout.flush() + # Use _stepped as an indication to if we need a newline before + # the next message + self._stepped = True + elif code == progressQ.PROGRESS_CODE_MESSAGE: + # This should already be translated + if self._stepped: + # Get a new line in case we've done a step before + self._stepped = False + print('') + print(args[0]) + elif code == progressQ.PROGRESS_CODE_COMPLETE: + # There shouldn't be any more progress updates, so return + q.task_done() + + + if self._stepped: + print('') + return True + elif code == progressQ.PROGRESS_CODE_QUIT: + sys.exit(args[0]) + + q.task_done() + return True + + def refresh(self, args = None): + from pyanaconda.install import doInstall, doConfiguration + from pyanaconda.threads import threadMgr, AnacondaThread + + # We print this here because we don't really use the window object + print(self.title) + + threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall, + args=(self.storage, self.payload, self.data, + self.instclass))) + + # This will run until we're all done with the install thread. + self._update_progress() + + threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration, + args=(self.storage, self.payload, self.data, + self.instclass))) + + # This will run until we're all done with the configuration thread. + self._update_progress() + + # kickstart install, continue automatically if reboot or shutdown selected + if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]: + # Just pretend like we got input, and our input doesn't care + # what it gets, it just quits. + self.input(None, None) + + return True + + def prompt(self, args = None): + return(_("\tInstallation complete. Press return to quit")) + + def input(self, args, key): + # There is nothing to do here, just raise to exit the spoke + raise ExitAllMainLoops()
On Tue, Sep 17, 2013 at 11:38:49AM +0200, Vratislav Podzimek wrote:
The progress screen in text mode is not a hub. It cannot provide any spokes because it prints a lot of text to the output and spokes would be rolled off in a moment. It should be a standalone spoke which also fixes the issue with it not being scheduled because of no spokes to be provided.
Resolves: rhbz#1008788
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
<> diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py new file mode 100644 index 0000000..44adb43 --- /dev/null +++ b/pyanaconda/ui/tui/spokes/progress.py @@ -0,0 +1,140 @@ +# Text progress hub classes +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Jesse Keating jkeating@redhat.com +#
+import sys
+from pyanaconda.flags import flags +from pyanaconda.i18n import _ +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION +from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
+from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
+__all__ = ["ProgressSpoke"]
+class ProgressSpoke(StandaloneTUISpoke):
- title = _("Progress")
- postForHub = SummaryHub
Is this necessary? It wasn't in the original, so I'm curious why you've added it now.
Aside from that, this looks good. I think this is the better and more appropriate way of fixing that bug as well.
Samantha
On Tue, 2013-09-17 at 09:41 -0400, Samantha N. Bueno wrote:
On Tue, Sep 17, 2013 at 11:38:49AM +0200, Vratislav Podzimek wrote:
The progress screen in text mode is not a hub. It cannot provide any spokes because it prints a lot of text to the output and spokes would be rolled off in a moment. It should be a standalone spoke which also fixes the issue with it not being scheduled because of no spokes to be provided.
Resolves: rhbz#1008788
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
<> diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py new file mode 100644 index 0000000..44adb43 --- /dev/null +++ b/pyanaconda/ui/tui/spokes/progress.py @@ -0,0 +1,140 @@ +# Text progress hub classes +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Jesse Keating jkeating@redhat.com +#
+import sys
+from pyanaconda.flags import flags +from pyanaconda.i18n import _ +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION +from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
+from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
+__all__ = ["ProgressSpoke"]
+class ProgressSpoke(StandaloneTUISpoke):
- title = _("Progress")
- postForHub = SummaryHub
Is this necessary? It wasn't in the original, so I'm curious why you've added it now.
You mean the postForHub attribute? I think that StandaloneSpokes should have preForHub or postForHub defined. It's used when sorting actions.
On Tue, Sep 17, 2013 at 05:13:02PM +0200, Vratislav Podzimek wrote:
On Tue, 2013-09-17 at 09:41 -0400, Samantha N. Bueno wrote:
On Tue, Sep 17, 2013 at 11:38:49AM +0200, Vratislav Podzimek wrote:
The progress screen in text mode is not a hub. It cannot provide any spokes because it prints a lot of text to the output and spokes would be rolled off in a moment. It should be a standalone spoke which also fixes the issue with it not being scheduled because of no spokes to be provided.
Resolves: rhbz#1008788
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
<> diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py new file mode 100644 index 0000000..44adb43 --- /dev/null +++ b/pyanaconda/ui/tui/spokes/progress.py @@ -0,0 +1,140 @@ +# Text progress hub classes +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Jesse Keating jkeating@redhat.com +#
+import sys
+from pyanaconda.flags import flags +from pyanaconda.i18n import _ +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION +from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
+from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
+__all__ = ["ProgressSpoke"]
+class ProgressSpoke(StandaloneTUISpoke):
- title = _("Progress")
- postForHub = SummaryHub
Is this necessary? It wasn't in the original, so I'm curious why you've added it now.
You mean the postForHub attribute? I think that StandaloneSpokes should have preForHub or postForHub defined. It's used when sorting actions.
Yeah, that was what I meant. I see what you mean now, the preForHub and postForHub is all detailed in pyanaconda.ui.common. This looks good to me then.
Samantha
On Tue, Sep 17, 2013 at 04:14:54PM -0400, Samantha N. Bueno wrote:
On Tue, Sep 17, 2013 at 05:13:02PM +0200, Vratislav Podzimek wrote:
On Tue, 2013-09-17 at 09:41 -0400, Samantha N. Bueno wrote:
On Tue, Sep 17, 2013 at 11:38:49AM +0200, Vratislav Podzimek wrote:
The progress screen in text mode is not a hub. It cannot provide any spokes because it prints a lot of text to the output and spokes would be rolled off in a moment. It should be a standalone spoke which also fixes the issue with it not being scheduled because of no spokes to be provided.
Resolves: rhbz#1008788
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
<> diff --git a/pyanaconda/ui/tui/spokes/progress.py b/pyanaconda/ui/tui/spokes/progress.py new file mode 100644 index 0000000..44adb43 --- /dev/null +++ b/pyanaconda/ui/tui/spokes/progress.py @@ -0,0 +1,140 @@ +# Text progress hub classes +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Jesse Keating jkeating@redhat.com +#
+import sys
+from pyanaconda.flags import flags +from pyanaconda.i18n import _ +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION +from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
+from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
+__all__ = ["ProgressSpoke"]
+class ProgressSpoke(StandaloneTUISpoke):
- title = _("Progress")
- postForHub = SummaryHub
Is this necessary? It wasn't in the original, so I'm curious why you've added it now.
You mean the postForHub attribute? I think that StandaloneSpokes should have preForHub or postForHub defined. It's used when sorting actions.
Yeah, that was what I meant. I see what you mean now, the preForHub and postForHub is all detailed in pyanaconda.ui.common. This looks good to me then.
Oh yeah one last thing, remember to add the changes to po/POTFILES.in.
Samantha
The TUI ProgressHub doesn't provide any spokes. However, we need to run it as it takes care of the actual installation.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/hubs/__init__.py | 3 ++- pyanaconda/ui/tui/hubs/progress.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py index 8f219c3..79ba2fe 100644 --- a/pyanaconda/ui/tui/hubs/__init__.py +++ b/pyanaconda/ui/tui/hubs/__init__.py @@ -48,6 +48,7 @@ class TUIHub(TUIObject, common.Hub): self._spokes = {} # holds spokes referenced by their class name self._keys = {} # holds spokes referenced by their user input key self._spoke_count = 0 + self._always_run = False
def setup(self, environment="anaconda"): # look for spokes having category present in self.categories @@ -76,7 +77,7 @@ class TUIHub(TUIObject, common.Hub): self._spokes[spoke.__class__.__name__] = spoke
# only schedule the hub if it has some spokes - return self._spoke_count != 0 + return self._always_run or self._spoke_count != 0
def refresh(self, args = None): """This methods fills the self._window list by all the objects diff --git a/pyanaconda/ui/tui/hubs/progress.py b/pyanaconda/ui/tui/hubs/progress.py index 82ad263..9340bcf 100644 --- a/pyanaconda/ui/tui/hubs/progress.py +++ b/pyanaconda/ui/tui/hubs/progress.py @@ -38,6 +38,9 @@ class ProgressHub(TUIHub): TUIHub.__init__(self, app, ksdata, storage, payload, instclass) self._stepped = False
+ # this hub should run even if it doesn't provide any spokes + self._always_run = True + def _update_progress(self): """Handle progress updates from install thread."""
On Tue, Sep 17, 2013 at 11:38:48AM +0200, Vratislav Podzimek wrote:
My commit 5634449a1645343f3be340aa39faebdd5436ab35 causes that the TUI ProgressHub is not scheduled/run because it provides no spokes and the result is that the actual installation is skipped, because it is triggered by the hub. There are two ways how to fix this issue:
- always schedule the TUI ProgressHub
- make ProgressHub a standalone spoke
I'm for 2. because the ProgressHub really is not a hub. It outputs a lot of text to the standard output and thus it cannot provide any spokes as those would be rolled off soon after the installation begins. However, 1. is much shorter and probably less invasive.
I agree, 2 is the better way to do this. I've tested this with text kickstart and livemedia-creator. Ack.
anaconda-patches@lists.fedorahosted.org