##// END OF EJS Templates
Prevents crash on some systems where chmod fails (e.g. sshfs on Windows)....
MinRK -
Show More
@@ -25,7 +25,7 b' import os'
25 import shutil
25 import shutil
26 import sys
26 import sys
27
27
28 from IPython.config.configurable import Configurable
28 from IPython.config.configurable import LoggingConfigurable
29 from IPython.config.loader import Config
29 from IPython.config.loader import Config
30 from IPython.utils.path import get_ipython_package_dir, expand_path
30 from IPython.utils.path import get_ipython_package_dir, expand_path
31 from IPython.utils.traitlets import List, Unicode, Bool
31 from IPython.utils.traitlets import List, Unicode, Bool
@@ -47,7 +47,7 b' class ProfileDirError(Exception):'
47 # Class for managing profile directories
47 # Class for managing profile directories
48 #-----------------------------------------------------------------------------
48 #-----------------------------------------------------------------------------
49
49
50 class ProfileDir(Configurable):
50 class ProfileDir(LoggingConfigurable):
51 """An object to manage the profile directory and its resources.
51 """An object to manage the profile directory and its resources.
52
52
53 The profile directory is used by all IPython applications, to manage
53 The profile directory is used by all IPython applications, to manage
@@ -98,7 +98,10 b' class ProfileDir(Configurable):'
98 if not os.path.isdir(self.security_dir):
98 if not os.path.isdir(self.security_dir):
99 os.mkdir(self.security_dir, 0700)
99 os.mkdir(self.security_dir, 0700)
100 else:
100 else:
101 try:
101 os.chmod(self.security_dir, 0700)
102 os.chmod(self.security_dir, 0700)
103 except OSError:
104 self.log.warn("Could not set security dir permissions to private.")
102
105
103 def _pid_dir_changed(self, name, old, new):
106 def _pid_dir_changed(self, name, old, new):
104 self.check_pid_dir()
107 self.check_pid_dir()
@@ -107,7 +110,10 b' class ProfileDir(Configurable):'
107 if not os.path.isdir(self.pid_dir):
110 if not os.path.isdir(self.pid_dir):
108 os.mkdir(self.pid_dir, 0700)
111 os.mkdir(self.pid_dir, 0700)
109 else:
112 else:
113 try:
110 os.chmod(self.pid_dir, 0700)
114 os.chmod(self.pid_dir, 0700)
115 except OSError:
116 self.log.warn("Could not set pid dir permissions to private.")
111
117
112 def check_dirs(self):
118 def check_dirs(self):
113 self.check_security_dir()
119 self.check_security_dir()
General Comments 0
You need to be logged in to leave comments. Login now