This encoding, part of the standard Python installation, is used by
the pickle module (in turn used by subprocess when handling
failures in program execution). Preloading it means that Python will
cache it in memory so that even if the disk goes away or just the
module, we're not going to fail in reporting errors.
---
 NEWS                |    3 +++
 lib/server/noded.py |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 73928ad..09b18a1 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,9 @@ Many bug-fixes and a few new small features:
 - Changed the instance memory modifications to only check out-of-memory
   conditions on memory increases, and turned the secondary node warnings
   into errors (they can still be overridden via ``--force``)
+- Fixed the handling of a corner case when the Python installation gets
+  corrupted (e.g. a bad disk) while ganeti-noded is running and we try
+  to execute a command that doesn't exist
 
 And as usual, various improvements to the error messages, documentation
 and man pages.
diff --git a/lib/server/noded.py b/lib/server/noded.py
index decc874..c6bba72 100644
--- a/lib/server/noded.py
+++ b/lib/server/noded.py
@@ -33,6 +33,7 @@ import os
 import sys
 import logging
 import signal
+import codecs
 
 from optparse import OptionParser
 
@@ -964,6 +965,13 @@ def CheckNoded(_, args):
     print >> sys.stderr, ("Usage: %s [-f] [-d] [-p port] [-b ADDRESS]" %
                           sys.argv[0])
     sys.exit(constants.EXIT_FAILURE)
+  try:
+    codecs.lookup("string-escape")
+  except LookupError:
+    print >> sys.stderr, ("Can't load the string-escape code which is part"
+                          " of the Python installation. Is your installation"
+                          " complete/correct? Aborting.")
+    sys.exit(constants.EXIT_FAILURE)
 
 
 def PrepNoded(options, _):
-- 
1.7.3.1

Reply via email to