Add permissions warning
authorThierry Florac <thierry.florac@onf.fr>
Fri, 06 Oct 2017 09:39:50 +0200
changeset 8 8ab3fffe8d36
parent 7 17dcd938afa3
child 9 8dba3d0aac03
Add permissions warning
hooks/post_gen_project.py
--- a/hooks/post_gen_project.py	Fri Oct 06 09:21:29 2017 +0200
+++ b/hooks/post_gen_project.py	Fri Oct 06 09:39:50 2017 +0200
@@ -44,7 +44,10 @@
     except PermissionError:
         print("WARNING: Can't create logs directory {0}".format(LOGS_DIRECTORY))
     else:
-        os.chown(LOGS_DIRECTORY, user_id, group_id)
+        try:
+            os.chown(LOGS_DIRECTORY, user_id, group_id)
+        except PermissionError:
+            print("WARNING: Can't set owner ({0}:{1}) for directory {2}".format(user_id, group_id, LOGS_DIRECTORY))
 
 
 #