Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stackinator/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def environment_meta(self, recipe):
meta["name"] = conf["name"]
meta["description"] = conf["description"]
meta["views"] = recipe.environment_view_meta
meta["default-view"] = recipe.default_view
meta["mount"] = str(recipe.mount)
modules = None
if recipe.with_modules:
Expand Down
30 changes: 22 additions & 8 deletions stackinator/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ def __init__(self, args):
self._logger.error(f"modules.yaml:{self.with_modules}")
raise RuntimeError("conflicting modules configuration detected")

# optional packages.yaml file
packages_path = self.path / "packages.yaml"
self._logger.debug(f"opening {packages_path}")
self.packages = None
if packages_path.is_file():
with packages_path.open() as fid:
self.packages = yaml.load(fid, Loader=yaml.Loader)

self._logger.debug("creating packages")

# load recipe/packages.yaml -> recipe_packages (if it exists)
Expand Down Expand Up @@ -169,6 +161,21 @@ def __init__(self, args):
schema.EnvironmentsValidator.validate(raw)
self.generate_environment_specs(raw)

# check that the default view exists (if one has been set)
self._default_view = self.config["default-view"]
if self._default_view is not None:
available_views = [view["name"] for env in self.environments.values() for view in env["views"]]
# add the modules and spack views to the list of available views
if self.with_modules:
available_views.append("modules")
available_views.append("spack")
if self._default_view not in available_views:
self._logger.error(
f"The default-view {self._default_view} is not the name of a view in the environments.yaml "
"definition (one of {[name for name in available_views]}"
)
raise RuntimeError("Ivalid default-view in the recipe.")

# optional mirror configurtion
mirrors_path = self.path / "mirrors.yaml"
if mirrors_path.is_file():
Expand Down Expand Up @@ -286,6 +293,13 @@ def with_modules(self) -> bool:
def find_spack_version(self, develop):
return "1.0"

# Returns:
# Path: if the recipe contains a spack package repository
# None: if there is the recipe contains no repo
Comment on lines +296 to +298
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Returns:
# Path: if the recipe contains a spack package repository
# None: if there is the recipe contains no repo

Un-related?

@property
def default_view(self):
return self._default_view

@property
def environment_view_meta(self):
# generate the view meta data that is presented in the squashfs image meta data
Expand Down
25 changes: 7 additions & 18 deletions stackinator/schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,6 @@
}
}
},
"mirror" : {
"type" : "object",
"additionalProperties": false,
"default": {"enable": true, "key": null},
"properties" : {
"enable" : {
"type": "boolean",
"default": true
},
"key" : {
"oneOf": [
{"type" : "string"},
{"type" : "null"}
],
"default": null
}
}
},
"modules" : {
"type": "boolean"
},
Expand All @@ -74,6 +56,13 @@
],
"default": null
},
"default-view" : {
"oneOf": [
{"type" : "string"},
{"type" : "null"}
],
"default": null
},
"version" : {
"type": "number",
"default": 1,
Expand Down
Loading