Moodle remove displays a nice error when missing permissions
authorFrederic Massart <fred@moodle.com>
Fri, 10 Aug 2012 06:42:26 +0000 (14:42 +0800)
committerFrederic Massart <fred@moodle.com>
Fri, 10 Aug 2012 06:42:26 +0000 (14:42 +0800)
moodle-remove.py

index ba77579..95ad246 100755 (executable)
@@ -30,5 +30,12 @@ if not args.do:
                sys.exit(0)
 
 debug('Removing %s...' % args.name)
-Wp.delete(args.name)
+try:
+    Wp.delete(args.name)
+except OSError:
+    debug('Error while deleting the instance.')
+    debug('This is probably a permission issue.')
+    debug('Run: sudo chmod -R 0777 %s' % Wp.getPath(args.name))
+    sys.exit(1)
+
 debug('Instance removed')