Skip to content

Commit 38dc294

Browse files
committed
support setting modules and spack views as default view
1 parent 7213f56 commit 38dc294

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

stackinator/recipe.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ def __init__(self, args):
164164
# check that the default view exists (if one has been set)
165165
self._default_view = self.config["default-view"]
166166
if self._default_view is not None:
167-
if self._default_view not in [view["name"] for env in self.environments.values() for view in env["views"]]:
168-
self._logger.warning(
169-
"The default-view {self.default_view} is not the name of a view in the environments.yaml definition"
167+
available_views = [view["name"] for env in self.environments.values() for view in env["views"]]
168+
# add the modules and spack views to the list of available views
169+
if self.with_modules:
170+
available_views.append("modules")
171+
available_views.append("spack")
172+
if self._default_view not in available_views:
173+
self._logger.error(
174+
f"The default-view {self._default_view} is not the name of a view in the environments.yaml "
175+
"definition (one of {[name for name in available_views]}"
170176
)
171177
raise RuntimeError("Ivalid default-view in the recipe.")
172178

0 commit comments

Comments
 (0)