Report error if dirs `/data/user` `/data/scratch` are not created.
Created by: eesaanatluri
This reverts commit af813356 and removes dir creation if it doesn't exist in favor of explicitly handling the error in case of failure (i.e. if dir creation hook in acct. creation agent did not work and the dirs are not created).
Merge request reports
Activity
Filter activity
30 33 31 34 else: 32 35 if not path.exists(): 33 # Make sure folder exists and with right permission 34 path.mkdir(mode=0o700, parents=True, exist_ok=True) 35 36 # Make sure ownership is correct 37 shutil.chown(path, int(msg['uid']), int(msg['gid'])) 38 39 logger.debug(f'{path} created') 40 41 msg['success'] = True 36 # check if dirs exist and record any missing dirs 37 missing_dirs.append(path) 38 msg['success'] = False 39 msg['errmsg'] = f"Error: missing dirs {missing_dirs}" Created by: eesaanatluri
Yes, it would be overwritten but with latest data i.e, the last msg will contain all the missing dirs. So we are not missing the data here. I think it is correct. I tested it on console with an example as well.
>>> dirs = ['/home/a225', '/data/user/a225', '/data/scratch/a225'] >>> missing_dirs=[] >>> msg={} >>> for d in dirs: ... if not Path(d).exists(): ... missing_dirs.append(d) ... msg['errmsg'] = f"Error: missing dirs {missing_dirs}" ... >>> print(msg['errmsg']) Error: missing dirs ['/home/a225', '/data/user/a225', '/data/scratch/a225']
Please register or sign in to reply