From c156520dd4d15f9f9bfbf3431715c7c3505d4a1d Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Tue, 8 Jan 2013 18:23:47 -0600
Subject: [PATCH 03/10] Handle sending program output to tty5 through the
 logging setup.

---
 anaconda                                |  6 ++---
 pyanaconda/anaconda_log.py              |  4 +++
 pyanaconda/baseudev.py                  |  4 +--
 pyanaconda/bootloader.py                | 47 +++++++++------------------------
 pyanaconda/iutil.py                     | 10 +++----
 pyanaconda/keyboard.py                  |  3 +--
 pyanaconda/kickstart.py                 | 11 ++------
 pyanaconda/network.py                   |  3 +--
 pyanaconda/ntp.py                       |  3 +--
 pyanaconda/packaging/__init__.py        |  2 --
 pyanaconda/packaging/livepayload.py     |  3 +--
 pyanaconda/packaging/yumpayload.py      |  6 ++---
 pyanaconda/storage/__init__.py          |  6 ++---
 pyanaconda/storage/dasd.py              |  7 +----
 pyanaconda/storage/devicelibs/btrfs.py  |  5 +---
 pyanaconda/storage/devicelibs/dm.py     |  4 +--
 pyanaconda/storage/devicelibs/loop.py   |  6 +----
 pyanaconda/storage/devicelibs/lvm.py    | 19 ++++---------
 pyanaconda/storage/devicelibs/mdraid.py |  7 ++---
 pyanaconda/storage/devicelibs/swap.py   | 13 +++------
 pyanaconda/storage/devices.py           | 16 +++--------
 pyanaconda/storage/fcoe.py              | 33 ++++++++---------------
 pyanaconda/storage/formats/__init__.py  |  4 +--
 pyanaconda/storage/formats/fs.py        | 39 +++++++--------------------
 pyanaconda/storage/iscsi.py             | 21 +++++----------
 pyanaconda/storage/zfcp.py              |  3 +--
 pyanaconda/timezone.py                  |  2 +-
 27 files changed, 82 insertions(+), 205 deletions(-)

diff --git a/anaconda b/anaconda
index f291fb0..346f3b8 100755
--- a/anaconda
+++ b/anaconda
@@ -125,13 +125,11 @@ def set_x_resolution(runres):
         try:
             log.info("Setting the screen resolution to: %s.", runres)
             iutil.execWithRedirect("xrandr", 
-                                   ["-d", ":1", "-s", runres],
-                                   stdout="/dev/tty5", stderr="/dev/tty5")
+                                   ["-d", ":1", "-s", runres])
         except RuntimeError as e:
             log.error("The X resolution not set")
             iutil.execWithRedirect("xrandr",
-                                   ["-d", ":1", "-q"],
-                                   stdout="/dev/tty5", stderr="/dev/tty5")
+                                   ["-d", ":1", "-q"])
 
 def setupPythonUpdates():
     from distutils.sysconfig import get_python_lib
diff --git a/pyanaconda/anaconda_log.py b/pyanaconda/anaconda_log.py
index 207efe4..04e4efc 100644
--- a/pyanaconda/anaconda_log.py
+++ b/pyanaconda/anaconda_log.py
@@ -43,6 +43,7 @@ DATE_FORMAT = "%H:%M:%S"
 MAIN_LOG_FILE = "/tmp/anaconda.log"
 MAIN_LOG_TTY = "/dev/tty3"
 PROGRAM_LOG_FILE = "/tmp/program.log"
+PROGRAM_LOG_TTY = "/dev/tty5"
 STORAGE_LOG_FILE = "/tmp/storage.log"
 PACKAGING_LOG_FILE = "/tmp/packaging.log"
 ANACONDA_SYSLOG_FACILITY = SysLogHandler.LOG_LOCAL1
@@ -152,6 +153,9 @@ class AnacondaLog:
         program_logger.setLevel(logging.DEBUG)
         self.addFileHandler(PROGRAM_LOG_FILE, program_logger,
                             minLevel=logging.DEBUG)
+        self.addFileHandler(PROGRAM_LOG_TTY, program_logger,
+                            fmtStr=TTY_FORMAT,
+                            autoLevel=True)
         self.forwardToSyslog(program_logger)
 
         # Create the packaging logger.
diff --git a/pyanaconda/baseudev.py b/pyanaconda/baseudev.py
index 1e08da8..cd8d016 100644
--- a/pyanaconda/baseudev.py
+++ b/pyanaconda/baseudev.py
@@ -82,7 +82,7 @@ def udev_settle():
     # lots of disks, or with slow disks
     argv = ["settle", "--timeout=300"]
 
-    iutil.execWithRedirect("udevadm", argv, stderr="/dev/null")
+    iutil.execWithRedirect("udevadm", argv)
 
 def udev_trigger(subsystem=None, action="add", name=None):
     argv = ["trigger", "--action=%s" % action]
@@ -91,5 +91,5 @@ def udev_trigger(subsystem=None, action="add", name=None):
     if name:
         argv.append("--sysname-match=%s" % name)
 
-    iutil.execWithRedirect("udevadm", argv, stderr="/dev/null")
+    iutil.execWithRedirect("udevadm", argv)
     udev_settle()
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 10415e1..38d7f51 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1274,7 +1274,6 @@ class GRUB(BootLoader):
 
     def install(self):
         rc = iutil.execWithRedirect("grub-install", ["--just-copy"],
-                                    stdout="/dev/tty5", stderr="/dev/tty5",
                                     root=ROOT_PATH)
         if rc:
             raise BootLoaderError("bootloader install failed")
@@ -1296,7 +1295,6 @@ class GRUB(BootLoader):
             args = ["--batch", "--no-floppy",
                     "--device-map=%s" % self.device_map_file]
             rc = iutil.execWithRedirect("grub", args,
-                                        stdout="/dev/tty5", stderr="/dev/tty5",
                                         stdin=pread, root=ROOT_PATH)
             os.close(pread)
             if rc:
@@ -1458,7 +1456,6 @@ class GRUB2(GRUB):
         os.close(pwrite)
         buf = iutil.execWithCapture("grub2-mkpasswd-pbkdf2", [],
                                     stdin=pread,
-                                    stderr="/dev/tty5",
                                     root=ROOT_PATH)
         os.close(pread)
         self.encrypted_password = buf.split()[-1].strip()
@@ -1503,16 +1500,14 @@ class GRUB2(GRUB):
                                                    self.default.version)
         rc = iutil.execWithRedirect("grub2-set-default",
                                     [entry_title],
-                                    root=ROOT_PATH,
-                                    stdout="/dev/tty5", stderr="/dev/tty5")
+                                    root=ROOT_PATH)
         if rc:
             log.error("failed to set default menu entry to %s" % productName)
 
         # now tell grub2 to generate the main configuration file
         rc = iutil.execWithRedirect("grub2-mkconfig",
                                     ["-o", self.config_file],
-                                    root=ROOT_PATH,
-                                    stdout="/dev/tty5", stderr="/dev/tty5")
+                                    root=ROOT_PATH)
         if rc:
             raise BootLoaderError("failed to write bootloader configuration")
 
@@ -1533,7 +1528,6 @@ class GRUB2(GRUB):
                 grub_args.insert(0, '--force')
 
             rc = iutil.execWithRedirect("grub2-install", grub_args,
-                                        stdout="/dev/tty5", stderr="/dev/tty5",
                                         root=ROOT_PATH,
                                         env_prune=['MALLOC_PERTURB_'])
             if rc:
@@ -1635,8 +1629,7 @@ class EFIGRUB(GRUB2):
                     continue
 
                 rc = self.efibootmgr("-b", slot_id, "-B",
-                                     root=ROOT_PATH,
-                                     stdout="/dev/tty5", stderr="/dev/tty5")
+                                     root=ROOT_PATH)
                 if rc:
                     raise BootLoaderError("failed to remove old efi boot entry")
 
@@ -1660,8 +1653,7 @@ class EFIGRUB(GRUB2):
                              "-d", boot_disk.path, "-p", boot_part_num,
                              "-l",
                              self.efi_dir_as_efifs_dir + "\\shim.efi",
-                             root=ROOT_PATH,
-                             stdout="/dev/tty5", stderr="/dev/tty5")
+                             root=ROOT_PATH)
         if rc:
             raise BootLoaderError("failed to set new efi boot target")
 
@@ -1697,8 +1689,7 @@ class MacEFIGRUB(EFIGRUB):
     def mactel_config(self):
         if os.path.exists(ROOT_PATH + "/usr/libexec/mactel-boot-setup"):
             rc = iutil.execWithRedirect("/usr/libexec/mactel-boot-setup", [],
-                                        root=ROOT_PATH,
-                                        stdout="/dev/tty5", stderr="/dev/tty5")
+                                        root=ROOT_PATH)
             if rc:
                 log.error("failed to configure Mac bootloader")
 
@@ -1833,7 +1824,6 @@ class Yaboot(YabootSILOBase):
     def install(self):
         args = ["-f", "-C", self.config_file]
         rc = iutil.execWithRedirect(self.prog, args,
-                                    stdout="/dev/tty5", stderr="/dev/tty5",
                                     root=ROOT_PATH)
         if rc:
             raise BootLoaderError("bootloader installation failed")
@@ -1864,8 +1854,7 @@ class IPSeriesYaboot(Yaboot):
         log.debug("updatePowerPCBootList: self.stage1_device.path = %s" % self.stage1_device.path)
 
         buf = iutil.execWithCapture("nvram",
-                                    ["--print-config=boot-device"],
-                                    stderr="/dev/tty5")
+                                    ["--print-config=boot-device"])
 
         if len(buf) == 0:
             log.error ("FAIL: nvram --print-config=boot-device")
@@ -1875,8 +1864,7 @@ class IPSeriesYaboot(Yaboot):
         log.debug("updatePowerPCBootList: boot_list = %s" % boot_list)
 
         buf = iutil.execWithCapture("ofpathname",
-                                    [self.stage1_device.path],
-                                    stderr="/dev/tty5")
+                                    [self.stage1_device.path])
 
         if len(buf) > 0:
             boot_disk = buf.strip()
@@ -1893,8 +1881,7 @@ class IPSeriesYaboot(Yaboot):
 
         update_value = "boot-device=%s" % " ".join(boot_list)
 
-        rc = iutil.execWithRedirect("nvram", ["--update-config", update_value],
-                                    stdout="/dev/tty5", stderr="/dev/tty5")
+        rc = iutil.execWithRedirect("nvram", ["--update-config", update_value])
         if rc:
             log.error("FAIL: nvram --update-config %s" % update_value)
         else:
@@ -1926,8 +1913,7 @@ class IPSeriesGRUB2(GRUB2):
         log.debug("updateNVRAMBootList: self.stage1_device.path = %s" % self.stage1_device.path)
 
         buf = iutil.execWithCapture("nvram",
-                                    ["--print-config=boot-device"],
-                                    stderr="/dev/tty5")
+                                    ["--print-config=boot-device"])
 
         if len(buf) == 0:
             log.error ("Failed to determine nvram boot device")
@@ -1937,8 +1923,7 @@ class IPSeriesGRUB2(GRUB2):
         log.debug("updateNVRAMBootList: boot_list = %s" % boot_list)
 
         buf = iutil.execWithCapture("ofpathname",
-                                    [self.stage1_device.path],
-                                    stderr="/dev/tty5")
+                                    [self.stage1_device.path])
 
         if len(buf) > 0:
             boot_disk = buf.strip()
@@ -1952,8 +1937,7 @@ class IPSeriesGRUB2(GRUB2):
 
         update_value = "boot-device=%s" % " ".join(boot_list)
 
-        rc = iutil.execWithRedirect("nvram", ["--update-config", update_value],
-                                    stdout="/dev/tty5", stderr="/dev/tty5")
+        rc = iutil.execWithRedirect("nvram", ["--update-config", update_value])
         if rc:
             log.error("Failed to update new boot device order")
 
@@ -2052,7 +2036,6 @@ class ZIPL(BootLoader):
 
     def install(self):
         buf = iutil.execWithCapture("zipl", [],
-                                    stderr="/dev/tty5",
                                     root=ROOT_PATH,
                                     fatal=True)
         for line in buf.splitlines():
@@ -2147,9 +2130,7 @@ class SILO(YabootSILOBase):
         else:
             args.append("-U")
 
-        rc = iutil.execWithRedirect("silo", args,
-                                    stdout="/dev/tty5", stderr="/dev/tty5",
-                                    root=ROOT_PATH)
+        rc = iutil.execWithRedirect("silo", args, root=ROOT_PATH)
 
         if rc:
             raise BootLoaderError("bootloader install failed")
@@ -2188,9 +2169,7 @@ class UBOOT(BootLoader):
     def install(self):
         _outfile = "%s/boot.scr" % self.config_dir
         args = ["-p", self.config_file, _outfile]
-        rc = iutil.execWithRedirect("cp", args,
-                                    stdout="/dev/tty5", stderr="/dev/tty5",
-                                    root=ROOT_PATH)
+        rc = iutil.execWithRedirect("cp", args, root=ROOT_PATH)
 
         if rc:
             raise BootLoaderError("bootloader install failed")
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index c86c63b..69355ab 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -878,9 +878,7 @@ def numeric_type(num):
 
 def reIPL(ipldev):
     try:
-        rc = execWithRedirect("chreipl", ["node", "/dev/" + ipldev],
-                              stdout = "/dev/tty5",
-                              stderr = "/dev/tty5")
+        rc = execWithRedirect("chreipl", ["node", "/dev/" + ipldev])
     except RuntimeError as e:
         rc = True
         log.info("Unable to set reIPL device to %s: %s",
@@ -1030,8 +1028,7 @@ def _run_systemctl(command, service):
     """
 
     service_name = service + ".service"
-    ret = execWithRedirect("systemctl", [command, service_name], stdin=None,
-                           stdout="/dev/tty5", stderr="/dev/tty5")
+    ret = execWithRedirect("systemctl", [command, service_name])
 
     return ret
 
@@ -1094,8 +1091,7 @@ def vtActivate(num):
     """
 
     try:
-        ret = execWithRedirect("chvt", [str(num)], stdout="/dev/tty5",
-                                stderr="/dev/tty5")
+        ret = execWithRedirect("chvt", [str(num)])
     except OSError as oserr:
         ret = -1
         log.error("Failed to run chvt: %s", oserr.strerror)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 8124904..3d811a1 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -237,8 +237,7 @@ def _try_to_load_keymap(keymap):
     ret = 0
 
     try:
-        ret = iutil.execWithRedirect("loadkeys", [keymap], stdout="/dev/tty5",
-                                     stderr="/dev/tty5")
+        ret = iutil.execWithRedirect("loadkeys", [keymap])
     except OSError as oserr:
         msg = "'loadkeys' command not available (%s)" % oserr.strerror
         raise KeyboardConfigError(msg)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 65a1e55..02cd5fa 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -238,9 +238,7 @@ class Authconfig(commands.authconfig.FC3_Authconfig):
             args += ["--enablefingerprint"]
 
         try:
-            iutil.execWithRedirect("/usr/sbin/authconfig", args,
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
-                                   root=ROOT_PATH)
+            iutil.execWithRedirect("/usr/sbin/authconfig", args, root=ROOT_PATH)
         except RuntimeError as msg:
             log.error("Error running /usr/sbin/authconfig %s: %s", args, msg)
 
@@ -484,9 +482,7 @@ class Firewall(commands.firewall.F14_Firewall):
             msg = _("%s is missing. Cannot setup firewall.") % (cmd,)
             raise KickstartError(msg)
         else:
-            iutil.execWithRedirect(cmd, args,
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
-                                   root=ROOT_PATH)
+            iutil.execWithRedirect(cmd, args, root=ROOT_PATH)
 
 class Firstboot(commands.firstboot.FC3_Firstboot):
     def execute(self, *args):
@@ -502,7 +498,6 @@ class Firstboot(commands.firstboot.FC3_Firstboot):
             f.close()
 
         iutil.execWithRedirect("systemctl", [action, "firstboot-graphical.service"],
-                               stdout="/dev/tty5", stderr="/dev/tty5",
                                root=ROOT_PATH)
 
 class Group(commands.group.F12_Group):
@@ -1171,12 +1166,10 @@ class Services(commands.services.FC6_Services):
 
         if disabled:
             iutil.execWithRedirect("systemctl", ["disable"] + disabled,
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
                                    root=ROOT_PATH)
 
         if enabled:
             iutil.execWithRedirect("systemctl", ["enable"] + enabled,
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
                                    root=ROOT_PATH)
 
 class Timezone(commands.timezone.F18_Timezone):
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 2bf7832..1e0833c 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -744,8 +744,7 @@ def setHostname(hn):
         return
 
     log.info("setting installation environment hostname to %s" % hn)
-    iutil.execWithRedirect("hostname", ["-v", hn ],
-                           stdout="/dev/tty5", stderr="/dev/tty5")
+    iutil.execWithRedirect("hostname", ["-v", hn ])
 
 def copyFileToPath(file, destPath='', overwrite=False):
     if not os.path.isfile(file):
diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py
index 006bef7..3542c0c 100644
--- a/pyanaconda/ntp.py
+++ b/pyanaconda/ntp.py
@@ -163,8 +163,7 @@ def one_time_sync(server, callback=None):
 
     """
 
-    ret = iutil.execWithRedirect("rdate", ["-s", server], stdout="/dev/tty5",
-                                 stderr="/dev/tty5")
+    ret = iutil.execWithRedirect("rdate", ["-s", server])
 
     success = ret == 0
 
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index f724088..4f38dd3 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -572,8 +572,6 @@ class Payload(object):
             iutil.execWithRedirect("new-kernel-pkg",
                                    ["--mkinitrd", "--dracut",
                                     "--depmod", "--install", kernel],
-                                   stdout="/dev/null",
-                                   stderr="/dev/null",
                                    root=ROOT_PATH)
         self._createdInitrds = True
 
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index ecade1a..03c464e 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -105,8 +105,7 @@ class LiveImagePayload(ImagePayload):
         args = ["-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
                 "--exclude", "/sys/", INSTALL_TREE+"/", ROOT_PATH]
         try:
-            rc = iutil.execWithRedirect(cmd, args,
-                                        stderr="/dev/tty5", stdout="/dev/tty5")
+            rc = iutil.execWithRedirect(cmd, args)
         except (OSError, RuntimeError) as e:
             msg = None
             err = str(e)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 98c105b..4637210 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -644,11 +644,9 @@ reposdir=%s
                     # move the mount to ISO_DIR
                     # work around inability to move shared filesystems
                     iutil.execWithRedirect("mount",
-                                           ["--make-rprivate", "/"],
-                                           stderr="/dev/tty5", stdout="/dev/tty5")
+                                           ["--make-rprivate", "/"])
                     iutil.execWithRedirect("mount",
-                                           ["--move", INSTALL_TREE, ISO_DIR],
-                                           stderr="/dev/tty5", stdout="/dev/tty5")
+                                           ["--move", INSTALL_TREE, ISO_DIR])
                     # Mounts are kept track of in isys it seems
                     # Remove the count for the source
                     if isys.mountCount.has_key(INSTALL_TREE):
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 54e9844..9d3af87 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -123,8 +123,7 @@ def storageInitialize(storage, ksdata, protected):
 
     # XXX I don't understand why I have to do this, but this is needed to
     #     populate the udev db
-    iutil.execWithRedirect("udevadm", ["control", "--property=ANACONDA=1"],
-                           stdout="/dev/tty5", stderr="/dev/tty5")
+    iutil.execWithRedirect("udevadm", ["control", "--property=ANACONDA=1"])
     udev_trigger(subsystem="block", action="change")
 
     # Before we set up the storage system, we need to know which disks to
@@ -160,8 +159,7 @@ def turnOnFilesystems(storage):
         if (flags.livecdInstall and not flags.imageInstall and not storage.fsset.active):
             # turn off any swaps that we didn't turn on
             # needed for live installs
-            iutil.execWithRedirect("swapoff", ["-a"],
-                                   stdout = "/dev/tty5", stderr="/dev/tty5")
+            iutil.execWithRedirect("swapoff", ["-a"])
         storage.devicetree.teardownAll()
 
     try:
diff --git a/pyanaconda/storage/dasd.py b/pyanaconda/storage/dasd.py
index 4f5fda2..6c583cb 100644
--- a/pyanaconda/storage/dasd.py
+++ b/pyanaconda/storage/dasd.py
@@ -81,8 +81,6 @@ class DASD:
             return
 
         self.started = True
-        out = "/dev/tty5"
-        err = "/dev/tty5"
 
         if not iutil.isS390():
             return
@@ -173,19 +171,16 @@ class DASD:
             try:
                 if intf and self.totalCylinders:
                     ret = iutil.execWithCallback(self.dasdfmt, arglist,
-                                                 stdout=out, stderr=err,
                                                  callback=update,
                                                  callback_data=pw,
                                                  echo=False)
                     rc = ret.rc
                 elif intf:
                     ret = iutil.execWithPulseProgress(self.dasdfmt, arglist,
-                                                      stdout=out, stderr=err,
                                                       progress=pw)
                     rc = ret.rc
                 else:
-                    rc = iutil.execWithRedirect(self.dasdfmt, arglist,
-                                                stdout=out, stderr=err)
+                    rc = iutil.execWithRedirect(self.dasdfmt, arglist)
             except Exception as e:
                 raise DasdFormatError(e, bypath)
 
diff --git a/pyanaconda/storage/devicelibs/btrfs.py b/pyanaconda/storage/devicelibs/btrfs.py
index bfc5e0a..b6d0e54 100644
--- a/pyanaconda/storage/devicelibs/btrfs.py
+++ b/pyanaconda/storage/devicelibs/btrfs.py
@@ -34,12 +34,10 @@ log = logging.getLogger("storage")
 
 def btrfs(args, capture=False):
     kwargs = {}
-    kwargs["stderr"] = "/dev/tty5"
     if capture:
         exec_func = iutil.execWithCapture
     else:
         exec_func = iutil.execWithRedirect
-        kwargs["stdout"] = "/dev/tty5"
 
     ret = exec_func("btrfs", args, **kwargs)
     if ret and not capture:
@@ -65,8 +63,7 @@ def create_volume(devices, label=None, data=None, metadata=None):
 
     args.extend(devices)
 
-    ret = iutil.execWithRedirect("mkfs.btrfs", args,
-                                 stdout="/dev/tty5", stderr="/dev/tty5")
+    ret = iutil.execWithRedirect("mkfs.btrfs", args)
     if ret:
         raise BTRFSError(ret)
 
diff --git a/pyanaconda/storage/devicelibs/dm.py b/pyanaconda/storage/devicelibs/dm.py
index cf4a0b8..b451890 100644
--- a/pyanaconda/storage/devicelibs/dm.py
+++ b/pyanaconda/storage/devicelibs/dm.py
@@ -33,9 +33,7 @@ import logging
 log = logging.getLogger("storage")
 
 def dm_setup(args):
-    ret = iutil.execWithRedirect("dmsetup", args,
-                                 stdout = "/dev/tty5",
-                                 stderr = "/dev/tty5")
+    ret = iutil.execWithRedirect("dmsetup", args)
     if ret:
         raise DMError(ret.stderr)
 
diff --git a/pyanaconda/storage/devicelibs/loop.py b/pyanaconda/storage/devicelibs/loop.py
index 132d4c3..92b3444 100644
--- a/pyanaconda/storage/devicelibs/loop.py
+++ b/pyanaconda/storage/devicelibs/loop.py
@@ -35,16 +35,12 @@ log = logging.getLogger("storage")
 def losetup(args, capture=False):
     if capture:
         exec_func = iutil.execWithCapture
-        exec_kwargs = {}
     else:
         exec_func = iutil.execWithRedirect
-        exec_kwargs = {"stdout": "/dev/tty5"}
 
     try:
         # ask losetup what this loop device's backing device is
-        ret = exec_func("losetup", args,
-                        stderr="/dev/tty5",
-                        **exec_kwargs)
+        ret = exec_func("losetup", args)
     except RuntimeError as e:
         raise LoopError(str(e))
 
diff --git a/pyanaconda/storage/devicelibs/lvm.py b/pyanaconda/storage/devicelibs/lvm.py
index c8b301f..2638ec7 100644
--- a/pyanaconda/storage/devicelibs/lvm.py
+++ b/pyanaconda/storage/devicelibs/lvm.py
@@ -158,9 +158,7 @@ def get_pv_space(size, disks, pesize=LVM_PE_SIZE,
     return space
 
 def lvm(args):
-    ret = iutil.execWithRedirect("lvm", args,
-                                 stdout = "/dev/tty5",
-                                 stderr = "/dev/tty5")
+    ret = iutil.execWithRedirect("lvm", args)
     if ret:
         raise LVMError("running lvm " + " ".join(args) + " failed")
 
@@ -214,8 +212,7 @@ def pvinfo(device):
             config_args + \
             [device]
 
-    rc = iutil.execWithCapture("lvm", args,
-                                stderr = "/dev/tty5")
+    rc = iutil.execWithCapture("lvm", args)
     vals = rc.split()
     if not vals:
         raise LVMError("pvinfo failed for %s" % device)
@@ -302,9 +299,7 @@ def vginfo(vg_name):
             config_args + \
             [vg_name]
 
-    buf = iutil.execWithCapture("lvm",
-                                args,
-                                stderr="/dev/tty5")
+    buf = iutil.execWithCapture("lvm", args)
     info = buf.split()
     if len(info) != 7:
         raise LVMError(_("vginfo failed for %s" % vg_name))
@@ -321,9 +316,7 @@ def lvs(vg_name):
             config_args + \
             [vg_name]
 
-    buf = iutil.execWithCapture("lvm",
-                                args,
-                                stderr="/dev/tty5")
+    buf = iutil.execWithCapture("lvm", args)
 
     lvs = {}
     for line in buf.splitlines():
@@ -345,9 +338,7 @@ def lvorigin(vg_name, lv_name):
             config_args + \
             ["%s/%s" % (vg_name, lv_name)]
 
-    buf = iutil.execWithCapture("lvm",
-                                args,
-                                stderr="/dev/tty5")
+    buf = iutil.execWithCapture("lvm", args)
 
     try:
         origin = buf.splitlines()[0].strip()
diff --git a/pyanaconda/storage/devicelibs/mdraid.py b/pyanaconda/storage/devicelibs/mdraid.py
index 13d7832..f8e93d5 100644
--- a/pyanaconda/storage/devicelibs/mdraid.py
+++ b/pyanaconda/storage/devicelibs/mdraid.py
@@ -169,9 +169,7 @@ def get_member_space(size, disks, level=None):
     return space * disks
 
 def mdadm(args):
-    ret = iutil.execWithRedirect("mdadm", args,
-                                 stdout = "/dev/tty5",
-                                 stderr = "/dev/tty5")
+    ret = iutil.execWithRedirect("mdadm", args)
     if ret:
         raise MDRaidError("running mdadm " + " ".join(args) + " failed")
 
@@ -236,8 +234,7 @@ def mddeactivate(device):
 
 def mdexamine(device):
     vars = iutil.execWithCapture("mdadm",
-                                 ["--examine", "--brief", device],
-                                 stderr="/dev/tty5").split()
+                                 ["--examine", "--brief", device]).split()
 
     info = {}
     if len(vars) > 1 and vars[1].startswith("/dev/md"):
diff --git a/pyanaconda/storage/devicelibs/swap.py b/pyanaconda/storage/devicelibs/swap.py
index 5113787..b96aefe 100644
--- a/pyanaconda/storage/devicelibs/swap.py
+++ b/pyanaconda/storage/devicelibs/swap.py
@@ -42,9 +42,7 @@ def mkswap(device, label=''):
         argv.extend(["-L", label])
     argv.append(device)
 
-    ret = iutil.execWithRedirect("mkswap", argv,
-                                 stderr = "/dev/tty5",
-                                 stdout = "/dev/tty5")
+    ret = iutil.execWithRedirect("mkswap", argv)
 
     if ret:
         raise SwapError("mkswap failed for '%s'" % device)
@@ -85,18 +83,13 @@ def swapon(device, priority=None):
         argv.extend(["-p", "%d" % priority])
     argv.append(device)
         
-    rc = iutil.execWithRedirect("swapon",
-                                argv,
-                                stderr = "/dev/tty5",
-                                stdout = "/dev/tty5")
+    rc = iutil.execWithRedirect("swapon", argv)
 
     if rc:
         raise SwapError("swapon failed for '%s'" % device)
 
 def swapoff(device):
-    rc = iutil.execWithRedirect("swapoff", [device],
-                                stderr = "/dev/tty5",
-                                stdout = "/dev/tty5")
+    rc = iutil.execWithRedirect("swapoff", [device])
 
     if rc:
         raise SwapError("swapoff failed for '%s'" % device)
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 1e082c7..d3897d0 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -1766,9 +1766,7 @@ class DMDevice(StorageDevice):
     def setupPartitions(self):
         log_method_call(self, name=self.name, kids=self.kids)
         rc = iutil.execWithRedirect("kpartx",
-                                ["-a", "-s", self.path],
-                                stdout = "/dev/tty5",
-                                stderr = "/dev/tty5")
+                                ["-a", "-s", self.path])
         if rc:
             raise DMError("partition activation failed for '%s'" % self.name)
         udev_settle()
@@ -1776,9 +1774,7 @@ class DMDevice(StorageDevice):
     def teardownPartitions(self):
         log_method_call(self, name=self.name, kids=self.kids)
         rc = iutil.execWithRedirect("kpartx",
-                                ["-d", "-s", self.path],
-                                stdout = "/dev/tty5",
-                                stderr = "/dev/tty5")
+                                ["-d", "-s", self.path])
         if rc:
             raise DMError("partition deactivation failed for '%s'" % self.name)
         udev_settle()
@@ -3377,9 +3373,7 @@ class MultipathDevice(DMDevice):
         if self.exists and os.path.exists(self.path):
             #self.teardownPartitions()
             #rc = iutil.execWithRedirect("multipath",
-            #                    ['-f', self.name],
-            #                    stdout = "/dev/tty5",
-            #                    stderr = "/dev/tty5")
+            #                    ['-f', self.name])
             #if rc:
             #    raise MPathError("multipath deactivation failed for '%s'" %
             #                    self.name)
@@ -3399,9 +3393,7 @@ class MultipathDevice(DMDevice):
                         controllable=self.controllable)
         udev_settle()
         rc = iutil.execWithRedirect("multipath",
-                            [self.name],
-                            stdout = "/dev/tty5",
-                            stderr = "/dev/tty5")
+                            [self.name])
         if rc:
             raise MPathError("multipath activation failed for '%s'" %
                             self.name, hardware_fault=True)
diff --git a/pyanaconda/storage/fcoe.py b/pyanaconda/storage/fcoe.py
index d061475..e839f10 100644
--- a/pyanaconda/storage/fcoe.py
+++ b/pyanaconda/storage/fcoe.py
@@ -34,13 +34,11 @@ _fcoe_module_loaded = False
 def has_fcoe():
     global _fcoe_module_loaded
     if not _fcoe_module_loaded:
-        iutil.execWithRedirect("modprobe", [ "fcoe" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect("modprobe", [ "fcoe" ])
         _fcoe_module_loaded = True
         if "bnx2x" in iutil.lsmod():
             log.info("fcoe: loading bnx2fc")
-            iutil.execWithRedirect("modprobe", [ "bnx2fc" ],
-                                   stdout = "/dev/tty5", stderr="/dev/tty5")
+            iutil.execWithRedirect("modprobe", [ "bnx2fc" ])
 
     return os.access("/sys/module/fcoe", os.X_OK)
 
@@ -69,12 +67,10 @@ class fcoe(object):
     def _stabilize(self):
         # I have no clue how long we need to wait, this ought to do the trick
         time.sleep(10)
-        iutil.execWithRedirect("udevadm", [ "settle" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect("udevadm", [ "settle" ])
 
     def _startEDD(self):
-        rc = iutil.execWithCapture("/usr/libexec/fcoe/fcoe_edd.sh", [ "-i" ],
-                                   stderr="/dev/tty5")
+        rc = iutil.execWithCapture("/usr/libexec/fcoe/fcoe_edd.sh", [ "-i" ])
         if not rc.startswith("NIC="):
             log.info("No FCoE EDD info found: %s" % rc.rstrip())
             return
@@ -101,8 +97,7 @@ class fcoe(object):
         if self.lldpadStarted:
             return
 
-        iutil.execWithRedirect("lldpad", [ "-d" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect("lldpad", [ "-d" ])
         self.lldpadStarted = True
 
     def addSan(self, nic, dcb=False, auto_vlan=True):
@@ -112,27 +107,21 @@ class fcoe(object):
         log.info("Activating FCoE SAN attached to %s, dcb: %s autovlan: %s" %
                  (nic, dcb, auto_vlan))
 
-        iutil.execWithRedirect("ip", [ "link", "set", nic, "up" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect("ip", [ "link", "set", nic, "up" ])
 
         if dcb:
             self._startLldpad()
-            iutil.execWithRedirect("dcbtool", [ "sc", nic, "dcb", "on" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+            iutil.execWithRedirect("dcbtool", [ "sc", nic, "dcb", "on" ])
             iutil.execWithRedirect("dcbtool", [ "sc", nic, "app:fcoe",
-                               "e:1", "a:1", "w:1" ],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+                                                "e:1", "a:1", "w:1" ])
             iutil.execWithRedirect("fipvlan", [ "-c", "-s", "-f",
-                                               "'-fcoe'", nic],
-                               stdout = "/dev/tty5", stderr="/dev/tty5")
+                                               "'-fcoe'", nic])
         else:
             if auto_vlan:
                 # certain network configrations require the VLAN layer module:
-                iutil.execWithRedirect("modprobe", ["8021q"],
-                                       stdout = "/dev/tty5", stderr="/dev/tty5")
+                iutil.execWithRedirect("modprobe", ["8021q"])
                 iutil.execWithRedirect("fipvlan", ['-c', '-s', '-f',
-                                                   "'-fcoe'",  nic],
-                                    stdout = "/dev/tty5", stderr="/dev/tty5")
+                                                   "'-fcoe'",  nic])
             else:
                 f = open("/sys/module/libfcoe/parameters/create", "w")
                 f.write(nic)
diff --git a/pyanaconda/storage/formats/__init__.py b/pyanaconda/storage/formats/__init__.py
index e1c8e14..7804389 100644
--- a/pyanaconda/storage/formats/__init__.py
+++ b/pyanaconda/storage/formats/__init__.py
@@ -305,9 +305,7 @@ class DeviceFormat(object):
         log_method_call(self, device=self.device,
                         type=self.type, status=self.status)
         try:
-            rc = execWithRedirect("wipefs", ["-a", self.device],
-                                  stderr="/dev/tty5",
-                                  stdout="/dev/tty5")
+            rc = execWithRedirect("wipefs", ["-a", self.device])
         except Exception as e:
             err = str(e)
         else:
diff --git a/pyanaconda/storage/formats/fs.py b/pyanaconda/storage/formats/fs.py
index b977a18..80c3e09 100644
--- a/pyanaconda/storage/formats/fs.py
+++ b/pyanaconda/storage/formats/fs.py
@@ -260,8 +260,7 @@ class FS(DeviceFormat):
                 values = []
                 argv = self._defaultInfoOptions + [ self.device ]
 
-                buf = iutil.execWithCapture(self.infofsProg, argv,
-                                            stderr="/dev/tty5")
+                buf = iutil.execWithCapture(self.infofsProg, argv)
 
                 for line in buf.splitlines():
                     found = False
@@ -364,10 +363,7 @@ class FS(DeviceFormat):
         argv = self._getFormatOptions(options=options)
 
         try:
-            ret = iutil.execWithRedirect(self.mkfsProg,
-                                         argv,
-                                         stdout="/dev/tty5",
-                                         stderr="/dev/tty5")
+            ret = iutil.execWithRedirect(self.mkfsProg, argv)
         except Exception as e:
             raise FormatCreateError(e, self.device)
 
@@ -421,9 +417,7 @@ class FS(DeviceFormat):
                      % (self.device, self.targetSize))
         try:
             ret = iutil.execWithRedirect(self.resizefsProg,
-                                         self.resizeArgs,
-                                         stdout="/dev/tty5",
-                                         stderr="/dev/tty5")
+                                         self.resizeArgs)
         except Exception as e:
             raise FSResizeError(e, self.device)
 
@@ -460,9 +454,7 @@ class FS(DeviceFormat):
 
         try:
             ret = iutil.execWithRedirect(self.fsckProg,
-                                         self._getCheckArgs(),
-                                         stdout="/dev/tty5",
-                                         stderr="/dev/tty5")
+                                         self._getCheckArgs())
         except Exception as e:
             raise FSError("filesystem check failed: %s" % e)
 
@@ -482,9 +474,7 @@ class FS(DeviceFormat):
 
         for module in self._modules:
             try:
-                rc = iutil.execWithRedirect("modprobe", [module],
-                                            stdout="/dev/tty5",
-                                            stderr="/dev/tty5")
+                rc = iutil.execWithRedirect("modprobe", [module])
             except Exception as e:
                 log.error("Could not load kernel module %s: %s" % (module, e))
                 self._supported = False
@@ -627,9 +617,7 @@ class FS(DeviceFormat):
             raise FSError("device does not exist")
 
         argv = self._getLabelArgs(label)
-        rc = iutil.execWithRedirect(self.labelfsProg,
-                                    argv,
-                                    stderr="/dev/tty5")
+        rc = iutil.execWithRedirect(self.labelfsProg, argv)
         if rc:
             raise FSError("label failed")
 
@@ -845,9 +833,7 @@ class Ext2FS(FS):
             rc = iutil.execWithRedirect("tune2fs",
                                         ["-U",
                                          "random",
-                                         self.device],
-                                        stdout="/dev/tty5",
-                                        stderr="/dev/tty5")
+                                         self.device])
         except Exception as e:
             err = str(e)
         else:
@@ -869,8 +855,7 @@ class Ext2FS(FS):
             if self.exists and os.path.exists(self.device):
                 # get block size
                 buf = iutil.execWithCapture(self.infofsProg,
-                                            ["-h", self.device],
-                                            stderr="/dev/tty5")
+                                            ["-h", self.device])
                 for line in buf.splitlines():
                     if line.startswith("Block size:"):
                         blockSize = int(line.split(" ")[-1])
@@ -885,8 +870,7 @@ class Ext2FS(FS):
 
                 # get minimum size according to resize2fs
                 buf = iutil.execWithCapture(self.resizefsProg,
-                                            ["-P", self.device],
-                                            stderr="/dev/tty5")
+                                            ["-P", self.device])
                 for line in buf.splitlines():
                     if "minimum size of the filesystem:" not in line:
                         continue
@@ -1201,14 +1185,12 @@ class XFS(FS):
 
         try:
             iutil.execWithRedirect("xfs_freeze", ["-f", self.mountpoint],
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
                                    root=root)
         except (RuntimeError, OSError) as e:
             log.error("failed to run xfs_freeze: %s" % e)
 
         try:
             iutil.execWithRedirect("xfs_freeze", ["-u", self.mountpoint],
-                                   stdout="/dev/tty5", stderr="/dev/tty5",
                                    root=root)
         except (RuntimeError, OSError) as e:
             log.error("failed to run xfs_freeze: %s" % e)
@@ -1294,8 +1276,7 @@ class NTFS(FS):
                iutil.find_program_in_path(self.resizefsProg):
                 minSize = None
                 buf = iutil.execWithCapture(self.resizefsProg,
-                                            ["-m", self.device],
-                                            stderr = "/dev/tty5")
+                                            ["-m", self.device])
                 for l in buf.split("\n"):
                     if not l.startswith("Minsize"):
                         continue
diff --git a/pyanaconda/storage/iscsi.py b/pyanaconda/storage/iscsi.py
index 3598ae0..78ce1a6 100644
--- a/pyanaconda/storage/iscsi.py
+++ b/pyanaconda/storage/iscsi.py
@@ -198,16 +198,12 @@ class iscsi(object):
             iscsi_iface_name = "iface%d" % len(self.ifaces)
             #iscsiadm -m iface -I iface0 --op=new
             iutil.execWithRedirect("iscsiadm",
-                                   ["-m", "iface", "-I", iscsi_iface_name, "--op=new"],
-                                   stdout="/dev/tty5",
-                                   stderr="/dev/tty5")
+                                   ["-m", "iface", "-I", iscsi_iface_name, "--op=new"])
             #iscsiadm -m iface -I iface0 --op=update -n iface.net_ifacename -v eth0
             iutil.execWithRedirect("iscsiadm",
                                    ["-m", "iface", "-I", iscsi_iface_name,
                                     "--op=update", "-n",
-                                    "iface.net_ifacename", "-v", iface],
-                                   stdout="/dev/tty5",
-                                   stderr="/dev/tty5")
+                                    "iface.net_ifacename", "-v", iface])
 
             self.ifaces[iscsi_iface_name] = iface
             log.debug("created_interface %s:%s" % (iscsi_iface_name, iface))
@@ -219,9 +215,7 @@ class iscsi(object):
             #iscsiadm -m iface -I iface0 --op=delete
             iutil.execWithRedirect("iscsiadm",
                                    ["-m", "iface", "-I", iscsi_iface_name,
-                                    "--op=delete"],
-                                   stdout="/dev/tty5",
-                                   stderr="/dev/tty5")
+                                    "--op=delete"])
         self.ifaces = {}
 
     def startup(self):
@@ -252,8 +246,7 @@ class iscsi(object):
                 os.makedirs(fulldir, 0755)
 
         log.info("iSCSI startup")
-        iutil.execWithRedirect('modprobe', ['-a'] + ISCSI_MODULES,
-                               stdout="/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect('modprobe', ['-a'] + ISCSI_MODULES)
         # iscsiuio is needed by Broadcom offload cards (bnx2i). Currently
         # not present in iscsi-initiator-utils for Fedora.
         try:
@@ -263,11 +256,9 @@ class iscsi(object):
             log.info("iscsi: iscsiuio not found.")
         else:
             log.debug("iscsi: iscsiuio is at %s" % iscsiuio)
-            iutil.execWithRedirect(iscsiuio, [],
-                                   stdout="/dev/tty5", stderr="/dev/tty5")
+            iutil.execWithRedirect(iscsiuio, [])
         # run the daemon
-        iutil.execWithRedirect(ISCSID, [],
-                               stdout="/dev/tty5", stderr="/dev/tty5")
+        iutil.execWithRedirect(ISCSID, [])
         time.sleep(1)
 
         self._startIBFT()
diff --git a/pyanaconda/storage/zfcp.py b/pyanaconda/storage/zfcp.py
index 3612dc0..28b2317 100644
--- a/pyanaconda/storage/zfcp.py
+++ b/pyanaconda/storage/zfcp.py
@@ -125,8 +125,7 @@ class ZFCPDevice:
 
         if not os.path.exists(online):
             log.info("Freeing zFCP device %s" % (self.devnum,))
-            iutil.execWithRedirect("zfcp_cio_free", ["-d", self.devnum],
-                                   stdout="/dev/tty5", stderr="/dev/tty5")
+            iutil.execWithRedirect("zfcp_cio_free", ["-d", self.devnum])
 
         if not os.path.exists(online):
             raise ValueError, _(
diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py
index 5337a21..6e8709b 100644
--- a/pyanaconda/timezone.py
+++ b/pyanaconda/timezone.py
@@ -115,7 +115,7 @@ def save_hw_clock(timezone):
     else:
         args.append("--local")
 
-    iutil.execWithRedirect(cmd, args, stdout="/dev/tty5", stderr="/dev/tty5")
+    iutil.execWithRedirect(cmd, args)
 
 
 def get_all_territory_timezones(territory):
-- 
1.7.11.7

