Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • slapos slapos
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 129
    • Merge requests 129
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • slaposslapos
  • Merge requests
  • !1867

slapconfiguration: don't try to get slave schema if there are no slaves

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Tom Niget requested to merge zdimension/slapos:slapconf-fix-slave into master Aug 12, 2025
  • Overview 3
  • Commits 2
  • Pipelines 0
  • Changes 1

Commit 4a593178 introduced a small but important change in behavior in slapconfiguration.

    if validate.shared:
      shared_list = options.pop('slave-instance-list')
+      shared_schema = self._getSharedSchema(software_description)
+      if shared_schema is None:
+        raise UserError(
+          "requested shared software-type %r seems to have no "
+          "JSON schema entry in the software.cfg.json."
+        )
      validator = DefaultValidator(
-        self._getSharedSchema(software_description),
+        shared_schema,
        set_defaults.shared,
        {'integer': int} if unstringify.shared else None,
      ) if shared_list else None # optimisation: skip creating unused validator

Before, _getSharedSchema was only called in the positive branch of the conditional on the last line, i.e. if there were slaves.

Now, it's called earlier, even if there are no slaves. This has consequences for cases where a single SR contains multiple software types, some of which have slaves and some of which don't.

Say a SR has types a, a-slave, and b. The first two have name a ad the second one has shared=True. Requesting an a will work, even with slaves, because there exists a shared software type with matching name. Requesting a b will fail because it'll try to fetch the schema for b's slaves, which don't exist.

Edited Aug 13, 2025 by Tom Niget
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: slapconf-fix-slave
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7