diff options
author | Krzysztof A. Adamski <krzysztofa@gmail.com> | 2008-07-07 19:29:06 -0400 |
---|---|---|
committer | Krzysztof A. Adamski <krzysztofa@gmail.com> | 2008-07-08 00:25:59 +0200 |
commit | cd7320d59ec7f6acc087507686a05711a59654bc (patch) | |
tree | 2583424af6904418c5b1f7115df24356c52948e9 /func | |
parent | 4a5de2e60b8173c19ef0eaa7eec4460d904a3bd2 (diff) | |
download | func-cd7320d59ec7f6acc087507686a05711a59654bc.tar.gz func-cd7320d59ec7f6acc087507686a05711a59654bc.tar.xz func-cd7320d59ec7f6acc087507686a05711a59654bc.zip |
Print userfriendly error messages instead of tracebacks in case of permissions errors.
Diffstat (limited to 'func')
-rw-r--r-- | func/jobthing.py | 12 | ||||
-rwxr-xr-x | func/overlord/client.py | 3 |
2 files changed, 12 insertions, 3 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.' |