commit ba90a608f6a6c0d5c2a0245a90d233f36fb05491
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Mon Feb 4 14:35:39 2013 +0100
slave: Don't crash when lnst-setup.sh is missing
lnst-slave crashed with exception if the init script file was missing.
This patch adds a check and only prints a warning, that the init was
skipped.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
lnst/Common/ResourceCache.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Common/ResourceCache.py b/lnst/Common/ResourceCache.py
index 9563d8c..a4ab955 100644
--- a/lnst/Common/ResourceCache.py
+++ b/lnst/Common/ResourceCache.py
@@ -17,6 +17,8 @@ import shutil
from lnst.Common.Utils import md5sum
from lnst.Common.ExecCmd import exec_cmd
+SETUP_SCRIPT_NAME = "lnst-setup.sh"
+
class ResourceCacheError(Exception):
pass
@@ -107,7 +109,13 @@ class ResourceCache(object):
tools_dir = "%s/%s" % (entry_dir, filename)
exec_cmd("tar xjmf \"%s\" -C \"%s\"" %
(entry_path, entry_dir))
- exec_cmd("cd \"%s\" && ./lnst-setup.sh" %
tools_dir)
+
+ if os.path.exists("%s/%s" % (tools_dir, SETUP_SCRIPT_NAME)):
+ exec_cmd("cd \"%s\" && ./%s" % (tools_dir,
SETUP_SCRIPT_NAME))
+ else:
+ msg = "%s not found in %s tools, skipping initialization." % \
+ (SETUP_SCRIPT_NAME, entry_name)
+ logging.warn(msg)
entry = {"type": entry_type, "name": entry_name,
"last_used": int(time.time()),
Show replies by date