diff options
-rw-r--r-- | func/jobthing.py | 12 | ||||
-rwxr-xr-x | func/overlord/client.py | 3 | ||||
-rwxr-xr-x | scripts/func | 7 |
3 files changed, 18 insertions, 4 deletions
diff --git a/func/jobthing.py b/func/jobthing.py index be23cc9..051480d 100644 --- a/func/jobthing.py +++ b/func/jobthing.py @@ -24,6 +24,7 @@ import fcntl import forkbomb import utils import pprint +from func.CommonErrors import * JOB_ID_RUNNING = 0 JOB_ID_FINISHED = 1 @@ -65,10 +66,17 @@ def __access_status(jobid=0, status=0, results=0, clear=False, write=False, purg dir = os.path.expanduser(CACHE_DIR) if not os.path.exists(dir): - os.makedirs(dir) + try: + os.makedirs(dir) + except IOError: + raise Func_Client_Exception, 'Cannot create directory for status files. '+\ + 'Ensure you have permission to create %s directory' % dir filename = os.path.join(dir,"status-%s" % os.getuid()) - handle = open(filename,"w") + try: + handle = open(filename,"w") + except IOError, e: + raise Func_Client_Exception, 'Cannot create status file. Ensure you have permission to write in %s directory' % dir fcntl.flock(handle.fileno(), fcntl.LOCK_EX) internal_db = dbm.open(filename, 'c', 0644 ) storage = shelve.Shelf(internal_db) diff --git a/func/overlord/client.py b/func/overlord/client.py index 727746b..c46cc1f 100755 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -214,7 +214,8 @@ class Overlord(object): self.key = fd_key self.cert = fd_crt else: - raise Func_Client_Exception, 'Cannot read ssl credentials: ssl, cert, ca' + raise Func_Client_Exception, 'Cannot read ssl credentials: ssl, cert, ca. '+\ + 'Ensure you have permission to read files in /etc/pki/certmaster/ directory.' diff --git a/scripts/func b/scripts/func index dcc4561..da2f50e 100755 --- a/scripts/func +++ b/scripts/func @@ -16,6 +16,7 @@ import sys import distutils.sysconfig +from func.CommonErrors import Func_Client_Exception # sys.path.append("%s/func" % distutils.sysconfig.get_python_lib()) @@ -23,6 +24,10 @@ import func.overlord.func_command as func_command myname, argv = sys.argv[0], sys.argv[1:] cli = func_command.FuncCommandLine() -cli.parse(argv) +try: + cli.parse(argv) +except Func_Client_Exception, e: + print "ERROR:", e + sys.exit(1) |