Skip to content

Commit 0831675

Browse files
review @pcrespov
1 parent 67eb5ad commit 0831675

File tree

1 file changed

+8
-12
lines changed
  • services/efs-guardian/src/simcore_service_efs_guardian/services

1 file changed

+8
-12
lines changed

services/efs-guardian/src/simcore_service_efs_guardian/services/efs_manager.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,25 @@ async def remove_project_node_data_write_permissions(
9898
async def list_projects_across_whole_efs(self) -> list[ProjectID]:
9999
_dir_path = self._efs_mounted_path / self._project_specific_data_base_directory
100100

101-
# List all items in the directory
102-
items = os.listdir(_dir_path)
103-
104101
# Filter and list only directories (which should be Project UUIDs)
105-
directories = []
106-
for item in items:
107-
_item_path = _dir_path / item
108-
if Path.is_dir(_item_path):
102+
project_uuids = []
103+
for child in _dir_path.iterdir():
104+
if child.is_dir():
109105
try:
110-
_project_id = parse_obj_as(ProjectID, item)
111-
directories.append(_project_id)
106+
_project_id = parse_obj_as(ProjectID, child.name)
107+
project_uuids.append(_project_id)
112108
except ValueError:
113109
_logger.error(
114110
"This is not a project ID. This should not happen! %s",
115-
_item_path,
111+
_dir_path / child.name,
116112
)
117113
else:
118114
_logger.error(
119115
"This is not a directory. This should not happen! %s",
120-
_item_path,
116+
_dir_path / child.name,
121117
)
122118

123-
return directories
119+
return project_uuids
124120

125121
async def remove_project_efs_data(self, project_id: ProjectID) -> None:
126122
_dir_path = (

0 commit comments

Comments
 (0)