Skip to content

Commit

Permalink
[api] Rename _get_extra_configs to _get_config and update related ref…
Browse files Browse the repository at this point in the history
…erences
  • Loading branch information
Harshg999 committed Feb 6, 2025
1 parent 0fa313e commit 3baaf96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions apps/filebrowser/src/filebrowser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ def _get_hdfs_home_directory(user):
return user.get_home_directory()


def _get_extra_configs(fs, request):
extra_configs = {}
def _get_config(fs, request):
config = {}
if fs == 'hdfs':
is_hdfs_superuser = _is_hdfs_superuser(request)
extra_configs = {
config = {
'is_trash_enabled': is_hdfs_trash_enabled(),
# TODO: Check if any of the below fields should be part of new Hue user and group management APIs
'is_hdfs_superuser': is_hdfs_superuser,
Expand All @@ -135,7 +135,7 @@ def _get_extra_configs(fs, request):
'superuser': request.fs.superuser,
'supergroup': request.fs.supergroup,
}
return extra_configs
return config


@api_error_handler
Expand Down Expand Up @@ -163,9 +163,9 @@ def get_all_filesystems(request):
filesystems = []
for fs in fsmanager.get_filesystems(request.user):
user_home_dir = fs_home_dir_mapping[fs](request.user)
extra_configs = _get_extra_configs(fs, request)
config = _get_config(fs, request)

filesystems.append({'file_system': fs, 'user_home_directory': user_home_dir, 'extra_configs': extra_configs})
filesystems.append({'file_system': fs, 'user_home_directory': user_home_dir, 'config': config})

return JsonResponse(filesystems, safe=False)

Expand Down
10 changes: 5 additions & 5 deletions apps/filebrowser/src/filebrowser/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ def test_get_all_filesystems_without_hdfs(self):

assert response.status_code == 200
assert response_data == [
{'file_system': 's3a', 'user_home_directory': 's3a://test-bucket/test-user-home-dir/', 'extra_configs': {}},
{'file_system': 'ofs', 'user_home_directory': 'ofs://', 'extra_configs': {}},
{'file_system': 's3a', 'user_home_directory': 's3a://test-bucket/test-user-home-dir/', 'config': {}},
{'file_system': 'ofs', 'user_home_directory': 'ofs://', 'config': {}},
]

def test_get_all_filesystems_success(self):
Expand Down Expand Up @@ -492,7 +492,7 @@ def test_get_all_filesystems_success(self):
{
'file_system': 'hdfs',
'user_home_directory': '/user/test-user',
'extra_configs': {
'config': {
'is_trash_enabled': False,
'is_hdfs_superuser': False,
'groups': [],
Expand All @@ -501,6 +501,6 @@ def test_get_all_filesystems_success(self):
'supergroup': 'test-supergroup',
},
},
{'file_system': 's3a', 'user_home_directory': 's3a://test-bucket/test-user-home-dir/', 'extra_configs': {}},
{'file_system': 'ofs', 'user_home_directory': 'ofs://', 'extra_configs': {}},
{'file_system': 's3a', 'user_home_directory': 's3a://test-bucket/test-user-home-dir/', 'config': {}},
{'file_system': 'ofs', 'user_home_directory': 'ofs://', 'config': {}},
]

0 comments on commit 3baaf96

Please sign in to comment.