Use constants defined in pyanaconda/constants.py for all thread names.
Signed-off-by: Martin Kolman <mkolman(a)gmail.com>
---
anaconda | 6 +++---
pyanaconda/constants.py | 18 ++++++++++++++++
pyanaconda/exception.py | 4 ++--
pyanaconda/ntp.py | 3 ++-
pyanaconda/packaging/__init__.py | 4 ++--
pyanaconda/packaging/livepayload.py | 4 ++--
pyanaconda/ui/gui/hubs/progress.py | 6 +++---
pyanaconda/ui/gui/spokes/custom.py | 3 ++-
pyanaconda/ui/gui/spokes/lib/refresh.py | 5 +++--
pyanaconda/ui/gui/spokes/network.py | 5 +++--
pyanaconda/ui/gui/spokes/software.py | 21 ++++++++++--------
pyanaconda/ui/gui/spokes/source.py | 38 ++++++++++++++++-----------------
pyanaconda/ui/gui/spokes/storage.py | 20 +++++++++--------
pyanaconda/ui/tui/hubs/progress.py | 6 +++---
pyanaconda/ui/tui/simpleline/base.py | 4 +++-
pyanaconda/ui/tui/spokes/storage.py | 9 ++++----
16 files changed, 93 insertions(+), 63 deletions(-)
diff --git a/anaconda b/anaconda
index 0d60c71..1e22ed4 100755
--- a/anaconda
+++ b/anaconda
@@ -1010,9 +1010,9 @@ if __name__ == "__main__":
networkInitialize(ksdata)
if not flags.dirInstall:
- threadMgr.add(AnacondaThread(name="AnaStorageThread",
target=storageInitialize, args=(anaconda.storage, ksdata, anaconda.protected)))
- threadMgr.add(AnacondaThread(name="AnaWaitForConnectingNMThread",
target=wait_for_connecting_NM_thread, args=(ksdata,)))
- threadMgr.add(AnacondaThread(name="AnaPayloadThread",
target=payloadInitialize, args=(anaconda.storage, ksdata, anaconda.payload)))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE,
target=storageInitialize, args=(anaconda.storage, ksdata, anaconda.protected)))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM,
target=wait_for_connecting_NM_thread, args=(ksdata,)))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_PAYLOAD, target=payloadInitialize,
args=(anaconda.storage, ksdata, anaconda.payload)))
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index 87f6daa..42f9374 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -100,3 +100,21 @@ RUNLEVELS = {3: 'multi-user.target', 5:
'graphical.target'}
# Network
NETWORK_CONNECTION_TIMEOUT = 45 # in seconds
+
+# Thread names
+THREAD_EXECUTE_STORAGE = "AnaExecuteStorageThread"
+THREAD_STORAGE = "AnaStorageThread"
+THREAD_STORAGE_WATCHER = "AnaStorageWatcher"
+THREAD_CHECK_STORAGE = "AnaCheckStorageThread"
+THREAD_WAIT_FOR_CONNECTING_NM = "AnaWaitForConnectingNMThread"
+THREAD_PAYLOAD = "AnaPayloadThread"
+THREAD_PAYLOAD_MD = "AnaPayloadMDThread"
+THREAD_INPUT_BASENAME = "AnaInputThread"
+THREAD_SYNC_TIME_BASENAME = "AnaSyncTime"
+THREAD_EXCEPTION_HANDLING_TEST = "AnaExceptionHandlingTest"
+THREAD_LIVE_PROGRESS = "AnaLiveProgressThread"
+THREAD_SOFTWARE_WATCHER = "AnaSoftwareWatcher"
+THREAD_CHECK_SOFTWARE = "AnaCheckSoftwareThread"
+THREAD_SOURCE_WATCHER = "AnaSourceWatcher"
+THREAD_INSTALL = "AnaInstallThread"
+THREAD_CONFIGURATION = "AnaConfigurationThread"
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 0119ebc..cfb84ed 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -33,7 +33,7 @@ import time
from flags import flags
import kickstart
import blivet.errors
-from pyanaconda.constants import ROOT_PATH
+from pyanaconda.constants import ROOT_PATH, THREAD_EXCEPTION_HANDLING_TEST
from gi.repository import GLib
import logging
@@ -230,6 +230,6 @@ f%s(msg, non_ascii)
# raise exception from a separate thread
# XXX: may create a circular dependency if imported globally
from pyanaconda.threads import AnacondaThread, threadMgr
- threadMgr.add(AnacondaThread(name="AnaExceptionHandlingTest",
+ threadMgr.add(AnacondaThread(name=THREAD_EXCEPTION_HANDLING_TEST,
target=raise_exception,
args=(msg, non_ascii)))
diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py
index 3542c0c..0da3e1f 100644
--- a/pyanaconda/ntp.py
+++ b/pyanaconda/ntp.py
@@ -30,6 +30,7 @@ import shutil
from pyanaconda import iutil
from pyanaconda.threads import threadMgr, AnacondaThread
+from pyanaconda.constants import THREAD_SYNC_TIME_BASENAME
NTP_CONFIG_FILE = "/etc/chrony.conf"
@@ -185,7 +186,7 @@ def one_time_sync_async(server, callback=None):
"""
- thread_name = "AnaSyncTime_%s" % server
+ thread_name = "%s_%s" % (THREAD_SYNC_TIME_BASENAME, server)
if threadMgr.get(thread_name):
#syncing with the same server running
return
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 3207c33..5abbc92 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -644,11 +644,11 @@ class PackagePayload(Payload):
def payloadInitialize(storage, ksdata, payload):
from pyanaconda.threads import threadMgr
- threadMgr.wait("AnaStorageThread")
+ threadMgr.wait(THREAD_STORAGE)
# FIXME: condition for cases where we don't want network
# (set and use payload.needsNetwork ?)
- threadMgr.wait("AnaWaitForConnectingNMThread")
+ threadMgr.wait(THREAD_WAIT_FOR_CONNECTING_NM)
payload.setup(storage)
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index b7c565c..0d9dd39 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -94,7 +94,7 @@ class LiveImagePayload(ImagePayload):
""" Install the payload. """
self.pct_lock = Lock()
self.pct = 0
- threadMgr.add(AnacondaThread(name="AnaLiveProgressThread",
+ threadMgr.add(AnacondaThread(name=THREAD_LIVE_PROGRESS,
target=self.progress))
cmd = "rsync"
@@ -123,7 +123,7 @@ class LiveImagePayload(ImagePayload):
# Wait for progress thread to finish
with self.pct_lock:
self.pct = 100
- threadMgr.wait("AnaLiveProgressThread")
+ threadMgr.wait(THREAD_LIVE_PROGRESS)
def postInstall(self):
""" Perform post-installation tasks. """
diff --git a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py
index 5fa5079..40c1531 100644
--- a/pyanaconda/ui/gui/hubs/progress.py
+++ b/pyanaconda/ui/gui/hubs/progress.py
@@ -33,7 +33,7 @@ import sys
from pyanaconda.localization import expand_langs
from pyanaconda.product import productName
from pyanaconda.flags import flags
-from pykickstart.constants import KS_WAIT, KS_SHUTDOWN, KS_REBOOT
+from pykickstart.constants import KS_WAIT, KS_SHUTDOWN, KS_REBOOT, THREAD_INSTALL,
THREAD_CONFIGURATION
from pyanaconda.ui.gui.hubs import Hub
from pyanaconda.ui.gui.utils import gtk_action_nowait, gtk_call_once
@@ -67,7 +67,7 @@ class ProgressHub(Hub):
self._start_ransom_notes()
self._progress_id = GLib.timeout_add(250, self._update_progress,
self._configuration_done)
- threadMgr.add(AnacondaThread(name="AnaConfigurationThread",
target=doConfiguration,
+ threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
args=(self.storage, self.payload, self.data,
self.instclass)))
def _start_ransom_notes(self):
@@ -217,7 +217,7 @@ class ProgressHub(Hub):
self._start_ransom_notes()
self._progress_id = GLib.timeout_add(250, self._update_progress,
self._install_done)
- threadMgr.add(AnacondaThread(name="AnaInstallThread",
target=doInstall,
+ threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
args=(self.storage, self.payload, self.data,
self.instclass)))
def _updateContinueButton(self):
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 1d4153a..627ac51 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -46,6 +46,7 @@ from pykickstart.constants import *
from pyanaconda.product import productName, productVersion
from pyanaconda.threads import threadMgr
+from pyanaconda.constants import THREAD_EXECUTE_STORAGE, THREAD_STORAGE
from blivet import devicefactory
from blivet.formats import device_formats
@@ -625,7 +626,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"]:
+ for thread_name in [THREAD_EXECUTE_STORAGE, THREAD_STORAGE]:
threadMgr.wait(thread_name)
self.passphrase = self.data.autopart.passphrase
diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.py
b/pyanaconda/ui/gui/spokes/lib/refresh.py
index 8212eb2..702ca6c 100644
--- a/pyanaconda/ui/gui/spokes/lib/refresh.py
+++ b/pyanaconda/ui/gui/spokes/lib/refresh.py
@@ -24,6 +24,7 @@ from gi.repository import GLib, Gtk
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.gui import GUIObject
+from pyanaconda import constants
from blivet import storageInitialize
@@ -52,7 +53,7 @@ class RefreshDialog(GUIObject):
return rc
def _check_rescan(self, *args):
- if threadMgr.get("AnaStorageThread"):
+ if threadMgr.get(constants.THREAD_STORAGE):
self._elapsed += 1
# If more than five seconds has elapsed since the rescan started,
@@ -90,7 +91,7 @@ class RefreshDialog(GUIObject):
# And now to fire up the storage reinitialization.
protectedNames = map(lambda d: d.name, self.storage.protectedDevices)
- threadMgr.add(AnacondaThread(name="AnaStorageThread",
target=storageInitialize,
+ threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE,
target=storageInitialize,
args=(self.storage, self.data, protectedNames)))
self._elapsed = 0
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 02edc21..bca4b19 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -34,6 +34,7 @@
from gi.repository import Gtk, AnacondaWidgets
from pyanaconda.flags import flags
+from pyanaconda import constants
from pyanaconda.ui import communication
from pyanaconda.ui.gui import GUIObject
from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke
@@ -1265,9 +1266,9 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
from pyanaconda.packaging import payloadInitialize
from pyanaconda.threads import threadMgr, AnacondaThread
- threadMgr.wait("AnaPayloadThread")
+ threadMgr.wait(constants.THREAD_PAYLOAD)
- threadMgr.add(AnacondaThread(name="AnaPayloadThread",
target=payloadInitialize, args=(self.storage, self.data, self.payload)))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_PAYLOAD,
target=payloadInitialize, args=(self.storage, self.data, self.payload)))
@property
def completed(self):
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index d80e097..5c51301 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -26,6 +26,7 @@ N_ = lambda x: x
from pyanaconda.flags import flags
from pyanaconda.packaging import MetadataError
from pyanaconda.threads import threadMgr, AnacondaThread
+from pyanaconda import constants
from pyanaconda.ui import communication
from pyanaconda.ui.gui.spokes import NormalSpoke
@@ -88,7 +89,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
communication.send_not_ready(self.__class__.__name__)
communication.send_not_ready("SourceSpoke")
- threadMgr.add(AnacondaThread(name="AnaCheckSoftwareThread",
+ threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
target=self.checkSoftwareSelection))
def apply(self):
@@ -115,7 +116,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
@property
def completed(self):
- processingDone = not threadMgr.get("AnaCheckSoftwareThread") and \
+ processingDone = not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and \
not self._errorMsgs and self.txid_valid
if flags.automatedInstall:
@@ -133,9 +134,10 @@ class SoftwareSelectionSpoke(NormalSpoke):
# wait until the installation source spoke is completed. This could be
# because the user filled something out, or because we're done fetching
# repo metadata from the mirror list, or we detected a DVD/CD.
- return (not threadMgr.get("AnaSoftwareWatcher") and
- not threadMgr.get("AnaPayloadMDThread") and
- not threadMgr.get("AnaCheckSoftwareThread") and
+
+ return (not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
+ not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
+ not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
self.payload.baseRepo is not None)
@property
@@ -167,12 +169,13 @@ class SoftwareSelectionSpoke(NormalSpoke):
def initialize(self):
NormalSpoke.initialize(self)
- threadMgr.add(AnacondaThread(name="AnaSoftwareWatcher",
target=self._initialize))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_SOFTWARE_WATCHER,
+ target=self._initialize))
def _initialize(self):
communication.send_message(self.__class__.__name__, _("Downloading package
metadata..."))
- threadMgr.wait("AnaPayloadThread")
+ threadMgr.wait(constants.THREAD_PAYLOAD)
communication.send_message(self.__class__.__name__, _("Downloading group
metadata..."))
@@ -180,7 +183,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
# so don't try.
if flags.automatedInstall and self.data.packages.seen:
# We don't want to do a full refresh, just join the metadata thread
- threadMgr.wait("AnaPayloadMDThread")
+ threadMgr.wait(constants.THREAD_PAYLOAD_MD)
else:
# Grabbing the list of groups could potentially take a long time
# at first (yum does a lot of magic property stuff, some of which
@@ -222,7 +225,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
def refresh(self):
NormalSpoke.refresh(self)
- threadMgr.wait("AnaPayloadMDThread")
+ threadMgr.wait(constants.THREAD_PAYLOAD_MD)
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 cf1524f..71f47e0 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -43,7 +43,7 @@ from pyanaconda.iutil import ProxyString, ProxyStringError,
cmp_obj_attrs
from pyanaconda.ui.gui.utils import gtk_call_once
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.packaging import PayloadError, MetadataError
-from pyanaconda.constants import DRACUT_ISODIR, ISO_DIR, BASE_REPO_NAME
+from pyanaconda import constants
from blivet.util import get_mount_paths
@@ -215,7 +215,7 @@ class IsoChooser(GUIObject):
GUIObject.refresh(self)
self._chooser = self.builder.get_object("isoChooser")
self._chooser.connect("current-folder-changed",
self.on_folder_changed)
- self._chooser.set_filename(ISO_DIR + "/" + currentFile)
+ self._chooser.set_filename(constants.ISO_DIR + "/" + currentFile)
def run(self, dev):
retval = None
@@ -225,16 +225,16 @@ class IsoChooser(GUIObject):
# We have to check both ISO_DIR and the DRACUT_ISODIR because we
# still reference both, even though /mnt/install is a symlink to
# /run/install. Finding mount points doesn't handle the symlink
- if ISO_DIR not in mounts and DRACUT_ISODIR not in mounts:
+ if constants.ISO_DIR not in mounts and constants.DRACUT_ISODIR not in mounts:
# We're not mounted to either location, so do the mount
- dev.format.mount(mountpoint=ISO_DIR)
+ dev.format.mount(mountpoint=constants.ISO_DIR)
# If any directory was chosen, return that. Otherwise, return None.
rc = self.window.run()
if rc:
f = self._chooser.get_filename()
if f:
- retval = f.replace(ISO_DIR, "")
+ retval = f.replace(constants.ISO_DIR, "")
if unmount:
dev.format.unmount()
@@ -251,8 +251,8 @@ class IsoChooser(GUIObject):
if not d:
return
- if not d.startswith(ISO_DIR):
- chooser.set_current_folder(ISO_DIR)
+ if not d.startswith(constants.ISO_DIR):
+ chooser.set_current_folder(constants.ISO_DIR)
class SourceSpoke(NormalSpoke):
builderObjects = ["isoChooser", "isoFilter",
"partitionStore", "sourceWindow", "dirImage",
"repoStore"]
@@ -282,7 +282,7 @@ class SourceSpoke(NormalSpoke):
repos_changed = self._update_payload_repos()
if method_changed or repos_changed:
- threadMgr.add(AnacondaThread(name="AnaPayloadMDThread",
+ threadMgr.add(AnacondaThread(name=constants.THREAD_PAYLOAD_MD,
target=self.getRepoMetadata))
self.clear_info()
@@ -470,14 +470,14 @@ class SourceSpoke(NormalSpoke):
def ready(self):
from pyanaconda.threads import threadMgr
return (self._ready and
- not threadMgr.get("AnaPayloadMDThread") and
- not threadMgr.get("AnaSoftwareWatcher") and
- not threadMgr.get("AnaCheckSoftwareThread"))
+ not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
+ not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
+ not threadMgr.get(constants.THREAD_CHECK_SOFTWARE))
@property
def status(self):
from pyanaconda.threads import threadMgr
- if threadMgr.get("AnaCheckSoftwareThread"):
+ if threadMgr.get(constants.THREAD_CHECK_SOFTWARE):
return _("Checking software dependencies...")
elif not self.ready:
return _("Not ready")
@@ -544,18 +544,18 @@ class SourceSpoke(NormalSpoke):
self._isoButton.connect("toggled", self.on_source_toggled,
self._isoBox)
self._networkButton.connect("toggled", self.on_source_toggled,
self._networkBox)
- threadMgr.add(AnacondaThread(name="AnaSourceWatcher",
target=self._initialize))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_SOURCE_WATCHER,
target=self._initialize))
def _initialize(self):
from pyanaconda.threads import threadMgr
communication.send_message(self.__class__.__name__, _("Probing
storage..."))
- threadMgr.wait("AnaStorageThread")
+ threadMgr.wait(constants.THREAD_STORAGE)
communication.send_message(self.__class__.__name__,
_(METADATA_DOWNLOAD_MESSAGE))
- threadMgr.wait("AnaPayloadThread")
+ threadMgr.wait(constants.THREAD_PAYLOAD)
added = False
@@ -761,10 +761,10 @@ class SourceSpoke(NormalSpoke):
# We have to check both ISO_DIR and the DRACUT_ISODIR because we
# still reference both, even though /mnt/install is a symlink to
# /run/install. Finding mount points doesn't handle the symlink
- if ISO_DIR not in mounts and DRACUT_ISODIR not in mounts:
+ if constants.ISO_DIR not in mounts and constants.DRACUT_ISODIR not in
mounts:
# We're not mounted to either location, so do the mount
- p.format.mount(mountpoint=ISO_DIR)
- dialog.run(ISO_DIR + "/" + f)
+ p.format.mount(mountpoint=constants.ISO_DIR)
+ dialog.run(constants.ISO_DIR + "/" + f)
if unmount:
p.format.unmount()
@@ -834,7 +834,7 @@ class SourceSpoke(NormalSpoke):
repos = self.payload.addOns
log.debug("Setting up repos: %s" % repos)
for name in repos:
- if name in [BASE_REPO_NAME, "updates"]:
+ if name in [constants.BASE_REPO_NAME, "updates"]:
continue
repo = self.payload.getAddOnRepo(name)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 082edb3..a3973e5 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -60,6 +60,7 @@ from blivet.platform import platform
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.product import productName
from pyanaconda.flags import flags
+from pyanaconda import constants
from pykickstart.constants import *
@@ -179,9 +180,9 @@ class InstallOptions1Dialog(GUIObject):
# Methods to handle sensitivity of the modify button.
def _software_is_ready(self):
# FIXME: Would be nicer to just ask the spoke if it's ready.
- return (not threadMgr.get("AnaPayloadThread") and
- not threadMgr.get("AnaSoftwareWatcher") and
- not threadMgr.get("AnaCheckSoftwareThread") and
+ return (not threadMgr.get(constants.THREAD_PAYLOAD) and
+ not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
+ not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
self.payload.baseRepo is not None)
def _check_for_storage_thread(self, button):
@@ -287,7 +288,7 @@ class StorageChecker(object):
def run(self):
communication.send_not_ready(self._mainSpokeClass)
- threadMgr.add(AnacondaThread(name="AnaCheckStorageThread",
+ threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_STORAGE,
target=self.checkStorage))
def checkStorage(self):
@@ -375,7 +376,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# Spawn storage execution as a separate thread so there's no big delay
# going back from this spoke to the hub while StorageChecker.run runs.
# Yes, this means there's a thread spawning another thread. Sorry.
- threadMgr.add(AnacondaThread(name="AnaExecuteStorageThread",
+ threadMgr.add(AnacondaThread(name=constants.THREAD_EXECUTE_STORAGE,
target=self._doExecute))
def _doExecute(self):
@@ -409,8 +410,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
@property
def completed(self):
- retval = (threadMgr.get("AnaExecuteStorageThread") is None and
- threadMgr.get("AnaCheckStorageThread") is None and
+ retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None and
+ threadMgr.get(constants.THREAD_CHECK_STORAGE) is None and
self.storage.rootDevice is not None and
not self.errors)
@@ -543,7 +544,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self.local_disks_box = self.builder.get_object("local_disks_box")
self.specialized_disks_box =
self.builder.get_object("specialized_disks_box")
- threadMgr.add(AnacondaThread(name="AnaStorageWatcher",
target=self._initialize))
+ threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
+ target=self._initialize))
def _add_disk_overview(self, disk, box):
if disk.removable:
@@ -583,7 +585,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
def _initialize(self):
communication.send_message(self.__class__.__name__, _("Probing
storage..."))
- threadMgr.wait("AnaStorageThread")
+ threadMgr.wait(constants.THREAD_STORAGE)
self.disks = getDisks(self.storage.devicetree)
diff --git a/pyanaconda/ui/tui/hubs/progress.py b/pyanaconda/ui/tui/hubs/progress.py
index 72cb5dc..cbe3e07 100644
--- a/pyanaconda/ui/tui/hubs/progress.py
+++ b/pyanaconda/ui/tui/hubs/progress.py
@@ -26,7 +26,7 @@ import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
from pyanaconda.flags import flags
-from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT
+from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT, THREAD_INSTALL,
THREAD_CONFIGURATION
from pyanaconda.ui.tui.hubs import TUIHub
from pyanaconda.ui.tui.simpleline.base import ExitAllMainLoops
@@ -101,14 +101,14 @@ class ProgressHub(TUIHub):
# We print this here because we don't really use the window object
print(self.title)
- threadMgr.add(AnacondaThread(name="AnaInstallThread",
target=doInstall,
+ 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="AnaConfigurationThread",
target=doConfiguration,
+ threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
args=(self.storage, self.payload, self.data,
self.instclass)))
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index 0aabe67..a8e588e 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -26,6 +26,7 @@ import Queue
import getpass
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.communication import HUB_CODE_EXCEPTION, HUB_CODE_INPUT
+from pyanaconda import constants
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -392,7 +393,8 @@ class App(object):
"""This method reads one input from user. Its basic form has only
one
line, but we might need to override it for more complex apps or
testing."""
- thread_name = "AnaInputThread%d" % self._in_thread_counter
+ thread_name = "%s%d" % (constants.THREAD_INPUT_BASENAME,
+ self._in_thread_counter)
self._in_thread_counter += 1
input_thread = AnacondaThread(name=thread_name,
target=self._thread_input,
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 2d0b23c..78fd14a 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -32,6 +32,7 @@ from blivet.errors import StorageError
from pyanaconda.flags import flags
from pyanaconda.kickstart import doKickstartStorage
from pyanaconda.threads import threadMgr, AnacondaThread
+from pyanaconda import constants
from pykickstart.constants import *
@@ -76,7 +77,7 @@ class StorageSpoke(NormalTUISpoke):
def ready(self):
# By default, the storage spoke is not ready. We have to wait until
# storageInitialize is done.
- return self._ready and not threadMgr.get("AnaStorageWatcher")
+ return self._ready and not threadMgr.get(constants.THREAD_STORAGE_WATCHER)
@property
def mandatory(self):
@@ -156,7 +157,7 @@ class StorageSpoke(NormalTUISpoke):
# Join the initialization thread to block on it
# This print is foul. Need a better message display
print(_("Probing storage..."))
- threadMgr.wait("AnaStorageWatcher")
+ threadMgr.wait(constants.THREAD_STORAGE_WATCHER)
# synchronize our local data store with the global ksdata
# Commment out because there is no way to select a disk right
@@ -260,7 +261,7 @@ class StorageSpoke(NormalTUISpoke):
def initialize(self):
NormalTUISpoke.initialize(self)
- threadMgr.add(AnacondaThread(name="AnaStorageWatcher",
+ threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
target=self._initialize))
self.selected_disks = self.data.ignoredisk.onlyuse[:]
@@ -270,7 +271,7 @@ class StorageSpoke(NormalTUISpoke):
# Secondary initialize so wait for the storage thread
# to complete before populating our disk list
- threadMgr.wait("AnaStorageThread")
+ threadMgr.wait(constants.THREAD_STORAGE)
self.disks = sorted(getDisks(self.storage.devicetree),
key=lambda d: d.name)
--
1.8.1.4