Skip to content

Commit bf8c804

Browse files
committed
fixup
1 parent 246545d commit bf8c804

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

mig/shared/useradm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,9 @@ def _provision_directories(configuration):
465465
try:
466466
dir_to_create = getattr(configuration, config_attr)
467467
os.mkdir(dir_to_create)
468-
except FileExistsError:
469-
pass
468+
except OSError as oserr:
469+
if oserr.errno != errno.ENOENT: # FileNotFoundError
470+
raise
470471

471472

472473
def create_user_in_db(configuration, db_path, client_id, user, now, authorized,
@@ -486,7 +487,7 @@ def create_user_in_db(configuration, db_path, client_id, user, now, authorized,
486487
if do_lock:
487488
try:
488489
flock = lock_user_db(db_path)
489-
except OSError as oserr:
490+
except (IOError, OSError) as oserr:
490491
if oserr.errno != errno.ENOENT: # FileNotFoundError
491492
raise
492493

tests/test_mig_server_createuser.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ def before_each(self):
4141
configuration = self.configuration
4242
test_state_path = configuration.state_path
4343

44-
for state_dir in ('user_db_home', 'user_home', 'user_settings', 'user_cache', 'mrsl_files', 'resource_pending'):
45-
stat_dir_path = os.path.join(test_state_path, state_dir)
44+
for config_key in ('user_db_home', 'user_home', 'user_settings', 'user_cache', 'mrsl_files_dir', 'resource_pending'):
45+
dir_path = getattr(configuration, config_key)[0:-1]
4646
try:
47-
shutil.rmtree(stat_dir_path)
47+
shutil.rmtree(dir_path)
4848
except:
4949
pass
5050

51-
52-
test_user_db_home = os.path.join(test_state_path, 'user_db_home')
53-
self.expected_user_db_home = test_user_db_home
51+
self.expected_user_db_home = configuration.user_db_home[0:-1]
5452

5553
def _provide_configuration(self):
5654
return 'testconfig'

0 commit comments

Comments
 (0)