Skip to content

Commit db424c3

Browse files
authored
[BUG] - Make sure to get envs when the number of envs is less than page limit (#2939)
1 parent ecaa94b commit db424c3

File tree

1 file changed

+10
-13
lines changed
  • src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub

1 file changed

+10
-13
lines changed

src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,16 @@ def get_conda_store_environments(user_info: dict):
7373
# will contain all the environment info returned from the api
7474
env_data = []
7575

76-
# If there are more records than the specified size limit, then
77-
# will need to page through to get all the available envs
78-
if total_records > page_size:
79-
# generate a list of urls to hit to build the response
80-
urls = generate_paged_urls(base_url, total_records, page_size)
81-
82-
# get content from urls
83-
for url in urls:
84-
response = http.request(
85-
"GET", url, headers={"Authorization": f"Bearer {token}"}
86-
)
87-
decoded_response = json.loads(response.data.decode("UTF-8"))
88-
env_data += decoded_response.get("data", [])
76+
# generate a list of urls to hit to build the response
77+
urls = generate_paged_urls(base_url, total_records, page_size)
78+
79+
# get content from urls
80+
for url in urls:
81+
response = http.request(
82+
"GET", url, headers={"Authorization": f"Bearer {token}"}
83+
)
84+
decoded_response = json.loads(response.data.decode("UTF-8"))
85+
env_data += decoded_response.get("data", [])
8986

9087
# Filter and return conda environments for the user
9188
return [f"{env['namespace']['name']}-{env['name']}" for env in env_data]

0 commit comments

Comments
 (0)