Re: [PATCH 1/1] Clean up argument list after changing from rhpl to iutil for execWithRedirect

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

 



Looks good.

On 04/17/2009 01:43 PM, Jesse Keating wrote:
iutil uses subprocess.Popen and passes in the argv as a list, which causes
Popen to use the first entry of the list as the executable, and the rest of
the entires as arguments to that executable.  This is different from how
rhpl did things in which the first argument of the arglist had to be the
executable itself.

Also iutil expects argv to be a real list not a tuple.
---
  booty/alpha.py          |    4 ++--
  booty/bootloaderInfo.py |   10 +++++-----
  booty/ppc.py            |    2 +-
  booty/s390.py           |    3 +--
  booty/sparc.py          |    2 +-
  booty/x86.py            |    4 ++--
  6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/booty/alpha.py b/booty/alpha.py
index 461086c..efe4446 100644
--- a/booty/alpha.py
+++ b/booty/alpha.py
@@ -110,7 +110,7 @@ class alphaBootloaderInfo(bootloaderInfo):
              # Calling swriteboot. The first argument is the disk to write
              # to and the second argument is a path to the bootstrap loader
              # file.
-            args = ("swriteboot", ("/dev/%s" % wbd), "/boot/bootlx")
+            args = [("/dev/%s" % wbd), "/boot/bootlx"]
              iutil.execWithRedirect ('/sbin/swriteboot', args,
                                      root = instRoot,
                                      stdout = "/dev/tty5",
@@ -121,7 +121,7 @@ class alphaBootloaderInfo(bootloaderInfo):
              # the number of the partition on which aboot.conf resides.
              # It's always the boot partition whether it's / or /boot (with
              # the mount point being omitted.)
-            args = ("abootconf", ("/dev/%s" % wbd), str (bdpn))
+            args = [("/dev/%s" % wbd), str (bdpn)]
              iutil.execWithRedirect ('/sbin/abootconf', args,
                                      root = instRoot,
                                      stdout = "/dev/tty5",
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index b50a11a..dfd96d2 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -67,12 +67,12 @@ def syncDataToDisk(dev, mntpt, instRoot = "/"):
      # and xfs is even more "special" (#117968)
      if isys.readFSType(dev) == "xfs":
          iutil.execWithRedirect("/usr/sbin/xfs_freeze",
-                               ["/usr/sbin/xfs_freeze", "-f", mntpt],
+                               ["-f", mntpt],
                                 stdout = "/dev/tty5",
                                 stderr = "/dev/tty5",
                                 root = instRoot)
          iutil.execWithRedirect("/usr/sbin/xfs_freeze",
-                               ["/usr/sbin/xfs_freeze", "-u", mntpt],
+                               ["-u", mntpt],
                                 stdout = "/dev/tty5",
                                 stderr = "/dev/tty5",
                                 root = instRoot)
@@ -534,7 +534,7 @@ class efiBootloaderInfo(bootloaderInfo):
      # XXX wouldn't it be nice to have a real interface to use efibootmgr from?
      def removeOldEfiEntries(self, instRoot):
          p = os.pipe()
-        iutil.execWithRedirect('/usr/sbin/efibootmgr', ["efibootmgr"],
+        iutil.execWithRedirect('/usr/sbin/efibootmgr', [],
                                 root = instRoot, stdout = p[1])
          os.close(p[1])

@@ -552,7 +552,7 @@ class efiBootloaderInfo(bootloaderInfo):
              if string.join(fields[1:], " ") == productName:
                  entry = fields[0][4:8]
                  iutil.execWithRedirect('/usr/sbin/efibootmgr',
-                                       ["efibootmgr", "-b", entry, "-B"],
+                                       ["-b", entry, "-B"],
                                         root = instRoot,
                                         stdout="/dev/tty5", stderr="/dev/tty5")

@@ -582,7 +582,7 @@ class efiBootloaderInfo(bootloaderInfo):
          argv = [ "/usr/sbin/efibootmgr", "-c" , "-w", "-L",
                   productName, "-d", "/dev/%s" % bootdisk,
                   "-p", bootpart, "-l", "\\EFI\\redhat\\" + self.bootloader ]
-        iutil.execWithRedirect(argv[0], argv, root = instRoot,
+        iutil.execWithRedirect(argv[0], argv[1:], root = instRoot,
                                 stdout = "/dev/tty5",
                                 stderr = "/dev/tty5")

diff --git a/booty/ppc.py b/booty/ppc.py
index e1a9489..4633f07 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -144,7 +144,7 @@ class ppcBootloaderInfo(bootloaderInfo):

          if not flags.test:
              iutil.execWithRedirect(ybinargs[0],
-                                   ybinargs,
+                                   ybinargs[1:],
                                     stdout = "/dev/tty5",
                                     stderr = "/dev/tty5",
                                     root = instRoot)
diff --git a/booty/s390.py b/booty/s390.py
index 575ab28..717f50f 100644
--- a/booty/s390.py
+++ b/booty/s390.py
@@ -153,8 +153,7 @@ class s390BootloaderInfo(bootloaderInfo):
          f.close()

          if not justConfigFile:
-            argv = [ "/sbin/zipl" ]
-            iutil.execWithRedirect(argv[0], argv, root = instRoot,
+            iutil.execWithRedirect("/sbin/zipl", [], root = instRoot,
                                     stdout = "/dev/stdout",
                                     stderr = "/dev/stderr")

diff --git a/booty/sparc.py b/booty/sparc.py
index b094a45..39b84f1 100644
--- a/booty/sparc.py
+++ b/booty/sparc.py
@@ -95,7 +95,7 @@ class sparcBootloaderInfo(bootloaderInfo):

          if not flags.test:
              iutil.execWithRedirect(sbinargs[0],
-                                   sbinargs,
+                                   sbinargs[1:],
                                     stdout = "/dev/tty5",
                                     stderr = "/dev/tty5",
                                     root = instRoot)
diff --git a/booty/x86.py b/booty/x86.py
index d710fbb..99f2e5d 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -71,7 +71,7 @@ class x86BootloaderInfo(efiBootloaderInfo):

          # copy the stage files over into /boot
          iutil.execWithRedirect("/sbin/grub-install",
-                               ["/sbin/grub-install", "--just-copy"],
+                               ["--just-copy"],
                                 stdout = "/dev/tty5", stderr = "/dev/tty5",
                                 root = instRoot)

@@ -89,7 +89,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
                  syncDataToDisk(bootDev, "/", instRoot)

              iutil.execWithRedirect('/sbin/grub' ,
-                                   [ "grub",  "--batch", "--no-floppy",
+                                   [ "--batch", "--no-floppy",
                                       "--device-map=/boot/grub/device.map" ],
                                     stdin = p[0],
                                     stdout = "/dev/tty5", stderr = "/dev/tty5",


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

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

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