From: "Brian C. Lane" bcl@redhat.com
This will raise an exception if the thread quit because of an error. --- pyanaconda/packaging/__init__.py | 8 ++------ pyanaconda/packaging/livepayload.py | 4 +--- pyanaconda/ui/gui/spokes/custom.py | 4 +--- pyanaconda/ui/gui/spokes/network.py | 4 +--- pyanaconda/ui/gui/spokes/software.py | 12 +++--------- pyanaconda/ui/gui/spokes/source.py | 8 ++------ pyanaconda/ui/gui/spokes/storage.py | 4 +--- pyanaconda/ui/tui/spokes/storage.py | 12 ++++-------- 8 files changed, 15 insertions(+), 41 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py index 35bde98..da4b301 100644 --- a/pyanaconda/packaging/__init__.py +++ b/pyanaconda/packaging/__init__.py @@ -663,15 +663,11 @@ class PackagePayload(Payload): def payloadInitialize(storage, ksdata, payload): from pyanaconda.threads import threadMgr
- storageThread = threadMgr.get("AnaStorageThread") - if storageThread: - storageThread.join() + threadMgr.wait("AnaStorageThread")
# FIXME: condition for cases where we don't want network # (set and use payload.needsNetwork ?) - networkThread = threadMgr.get("AnaWaitForConnectingNMThread") - if networkThread: - networkThread.join() + threadMgr.wait("AnaWaitForConnectingNMThread")
payload.setup(storage)
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py index ecade1a..ac55bbe 100644 --- a/pyanaconda/packaging/livepayload.py +++ b/pyanaconda/packaging/livepayload.py @@ -124,9 +124,7 @@ class LiveImagePayload(ImagePayload): # Wait for progress thread to finish with self.pct_lock: self.pct = 100 - progressThread = threadMgr.get("AnaLiveProgressThread") - if progressThread: - progressThread.join() + threadMgr.wait("AnaLiveProgressThread")
def postInstall(self): """ Perform post-installation tasks. """ diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index d14f6ba..94faef0 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -640,9 +640,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): # Make sure the storage spoke execute method has finished before we # copy the storage instance. for thread_name in ["AnaExecuteStorageThread", "AnaStorageThread"]: - t = threadMgr.get(thread_name) - if t: - t.join() + threadMgr.wait(thread_name)
self.passphrase = self.data.autopart.passphrase self._reset_storage() diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index f89be9f..622e724 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -1120,9 +1120,7 @@ class NetworkStandaloneSpoke(StandaloneSpoke): from pyanaconda.packaging import payloadInitialize from pyanaconda.threads import threadMgr, AnacondaThread
- payloadThread = threadMgr.get("AnaPayloadThread") - if payloadThread: - payloadThread.join() + threadMgr.wait("AnaPayloadThread")
threadMgr.add(AnacondaThread(name="AnaPayloadThread", target=payloadInitialize, args=(self.storage, self.data, self.payload)))
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index cbaf8f0..8598303 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -178,9 +178,7 @@ class SoftwareSelectionSpoke(NormalSpoke): def _initialize(self): communication.send_message(self.__class__.__name__, _("Downloading package metadata..."))
- payloadThread = threadMgr.get("AnaPayloadThread") - if payloadThread: - payloadThread.join() + threadMgr.wait("AnaPayloadThread")
communication.send_message(self.__class__.__name__, _("Downloading group metadata..."))
@@ -189,9 +187,7 @@ class SoftwareSelectionSpoke(NormalSpoke): if flags.automatedInstall and packagesSeen: # We don't want to do a full refresh, just # join the metadata thread - mdGatherThread = threadMgr.get("AnaPayloadMDThread") - if mdGatherThread: - mdGatherThread.join() + threadMgr.wait("AnaPayloadMDThread") else: if not self._first_refresh(): return @@ -222,9 +218,7 @@ class SoftwareSelectionSpoke(NormalSpoke): def refresh(self): NormalSpoke.refresh(self)
- mdGatherThread = threadMgr.get("AnaPayloadMDThread") - if mdGatherThread: - mdGatherThread.join() + threadMgr.wait("AnaPayloadMDThread")
self._environmentStore = self.builder.get_object("environmentStore") self._environmentStore.clear() diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py index 7faf0bc..cbd2514 100644 --- a/pyanaconda/ui/gui/spokes/source.py +++ b/pyanaconda/ui/gui/spokes/source.py @@ -678,15 +678,11 @@ class SourceSpoke(NormalSpoke):
communication.send_message(self.__class__.__name__, _("Probing storage..."))
- storageThread = threadMgr.get("AnaStorageThread") - if storageThread: - storageThread.join() + threadMgr.wait("AnaStorageThread")
communication.send_message(self.__class__.__name__, _(METADATA_DOWNLOAD_MESSAGE))
- payloadThread = threadMgr.get("AnaPayloadThread") - if payloadThread: - payloadThread.join() + threadMgr.wait("AnaPayloadThread")
added = False cdrom = None diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index 9cbc6d8..9aa510f 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -513,9 +513,7 @@ class StorageSpoke(NormalSpoke, StorageChecker): def _initialize(self): communication.send_message(self.__class__.__name__, _("Probing storage..."))
- storageThread = threadMgr.get("AnaStorageThread") - if storageThread: - storageThread.join() + threadMgr.wait("AnaStorageThread")
self.disks = getDisks(self.storage.devicetree)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py index b5d483f..5314438 100644 --- a/pyanaconda/ui/tui/spokes/storage.py +++ b/pyanaconda/ui/tui/spokes/storage.py @@ -183,11 +183,9 @@ class StorageSpoke(NormalTUISpoke): NormalTUISpoke.refresh(self, args)
# Join the initialization thread to block on it - initThread = threadMgr.get("AnaStorageWatcher") - if initThread: - # This print is foul. Need a better message display - print(_("Probing storage...")) - initThread.join() + # This print is foul. Need a better message display + print(_("Probing storage...")) + threadMgr.wait("AnaStorageWatcher")
# synchronize our local data store with the global ksdata # Commment out because there is no way to select a disk right @@ -301,9 +299,7 @@ class StorageSpoke(NormalTUISpoke): # Secondary initialize so wait for the storage thread # to complete before populating our disk list
- storageThread = threadMgr.get("AnaStorageThread") - if storageThread: - storageThread.join() + threadMgr.wait("AnaStorageThread")
self.disks = sorted(getDisks(self.storage.devicetree), key=lambda d: d.name)