[master 8/9] Reimplement the open override for the dracut scripts

dashea installerbot-noreply at redhat.com
Thu Jun 18 21:03:54 UTC 2015


From: David Shea <dshea at redhat.com>

These will run before pyanaconda is available
---
 dracut/driver-updates  |  9 +++++++++
 dracut/parse-kickstart | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/dracut/driver-updates b/dracut/driver-updates
index bdcfa0f..e16fe1d 100755
--- a/dracut/driver-updates
+++ b/dracut/driver-updates
@@ -47,6 +47,15 @@ import readline # pylint:disable=unused-import
 
 log = logging.getLogger("DD")
 
+import functools
+def eintr_retry_call(func, *args, **kwargs):
+    """Retry an interruptible system call if interrupted."""
+    while True:
+        try:
+            return func(*args, **kwargs)
+        except InterruptedError:
+            continue
+open = functools.partial(eintr_retry_call, open) # pylint: disable=redefined-builtin
 
 class RunCmdError(Exception):
     """ Raised when run_cmd gets a non-zero returncode
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 5612064..fc4d406 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -44,6 +44,16 @@ log = logging.getLogger('parse-kickstart').addHandler(logging.NullHandler())
 
 TMPDIR = "/tmp"
 
+import functools
+def eintr_retry_call(func, *args, **kwargs):
+    """Retry an interruptible system call if interrupted."""
+    while True:
+        try:
+            return func(*args, **kwargs)
+        except InterruptedError:
+            continue
+open = functools.partial(eintr_retry_call, open) # pylint: disable=redefined-builtin
+
 # Helper function for reading simple files in /sys
 def readsysfile(f):
     '''Return the contents of f, or "" if missing.'''


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/55423e28031ed1f04abfab6fcf2f4ca3c5a7effd


More information about the anaconda-patches mailing list