Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
slapos slapos
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 122
    • Merge requests 122
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • slaposslapos
  • Merge requests
  • !1426

Closed
Created Sep 08, 2023 by Titouan Soulard@tsoulardDeveloper
  • Report abuse
Report abuse

software/slapos-master: add required software.cfg.json for client compatibility

  • Overview 15
  • Commits 0
  • Changes 0

Description of the problem

Synopsis

Trying to launch a SlapOS Master would fail when using a parameter file. The command which caused the problem was the following: slapos request --state started --parameters-file ~/srv/project/request-parameter-slaposmaster.json slaposmaster ~/srv/project/slapos/software/slapos-master/software.cfg.

Cause

The root of this issue is that software/slapos-master does not contain a software.cfg.json, and JSON Schema is mandatory for using JSON-in-XML since MR #436 .

Proposed solution

Idea

The solution is quite obvious and involves creating a JSON Schema file for SlapOS Master. The only thing to do is to find the parameters to validate against.

1. Finding the parameters

Thinking that the parameters for SlapOS should be quite similar to the ones required for ERP5, I started by comparing stack/erp5/instance-erp5.cfg.in and software/slapos-master/instance-erp5.cfg.in, to find the parameters used by one and not the other. For the record, here is the command I ran and the terminal output:

# diff software/slapos-master/instance-erp5.cfg.in stack/erp5/instance-erp5.cfg.in | grep "slapparameter"
< {% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%}
> {% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout', 300) -%}
< {% if slapparameter_dict.get('shared-certificate-authority-path', '') -%}
< ca-dir = {{ slapparameter_dict.get('shared-certificate-authority-path') }}
< country-code = {{ dumps(slapparameter_dict.get('country-code', 'ZZ')) }}
< email = {{ dumps(slapparameter_dict.get('email', 'nobody@example.com')) }}
< state = {{ dumps(slapparameter_dict.get('state', "('State',)")) }}
< city = {{ dumps(slapparameter_dict.get('city', 'City')) }}
< company = {{ dumps(slapparameter_dict.get('company', 'Compagny')) }}

Seems like the files are indeed quite similar, the missing parameters are linked to the SSL/TLS certificate.

2. Creating the schema

Therefore, I copied the software.cfg.json, instance-erp5-input-schema.json, instance-erp5-output-schema.json and schemas-definitions.json files from software/erp5 to software/slapos-master. The final step is to update the parameters in instance-erp5-input-schema.json according to the results of step (1). SlapOS Master now has the right definitions and can be ran with a --parameters-file argument.

Edited Sep 12, 2023 by Titouan Soulard
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: add-missing-schema
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7