Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • slapos slapos
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 126
    • Merge requests 126
  • 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
  • nexedi
  • slaposslapos
  • Merge requests
  • !1867

Merged
Created Aug 12, 2025 by Tom Niget@zdimensionDeveloper

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

  • Overview 3
  • Commits 2
  • 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
Reviewer
Request review from
Time tracking
Source branch: slapconf-fix-slave
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7