equal
deleted
inserted
replaced
57 def create_dir(directory): |
57 def create_dir(directory): |
58 """create a directory if it doesn't exist yet""" |
58 """create a directory if it doesn't exist yet""" |
59 try: |
59 try: |
60 makedirs(directory) |
60 makedirs(directory) |
61 print '-> created directory %s' % directory |
61 print '-> created directory %s' % directory |
62 except OSError, ex: |
62 except OSError as ex: |
63 import errno |
63 import errno |
64 if ex.errno != errno.EEXIST: |
64 if ex.errno != errno.EEXIST: |
65 raise |
65 raise |
66 print '-> no need to create existing directory %s' % directory |
66 print '-> no need to create existing directory %s' % directory |
67 |
67 |
183 sys.stderr.write('ignoring malformed line\n%r\n' % line) |
183 sys.stderr.write('ignoring malformed line\n%r\n' % line) |
184 continue |
184 continue |
185 option = option.strip().replace(' ', '_') |
185 option = option.strip().replace(' ', '_') |
186 value = value.strip() |
186 value = value.strip() |
187 current[option] = value or None |
187 current[option] = value or None |
188 except IOError, ex: |
188 except IOError as ex: |
189 if raise_if_unreadable: |
189 if raise_if_unreadable: |
190 raise ExecutionError('%s. Are you logged with the correct user ' |
190 raise ExecutionError('%s. Are you logged with the correct user ' |
191 'to use this instance?' % ex) |
191 'to use this instance?' % ex) |
192 else: |
192 else: |
193 warning('missing or non readable configuration file %s (%s)', |
193 warning('missing or non readable configuration file %s (%s)', |