[SPM] Add support for configuring systemd service Type in package manifests#3946
Merged
qiluo-msft merged 2 commits intosonic-net:masterfrom Jul 14, 2025
Merged
Conversation
…ifests This change allows package developers to specify the systemd service type in their package manifests, which will be reflected in the generated systemd service files.
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
noaOrMlnx
approved these changes
Jul 2, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds optional support for specifying the systemd service Type in package manifests and updates the service template accordingly.
- Introduce a new
typefield in the manifest schema underservice - Update
sonic.service.j2template to emitType=whenmanifest.service.typeis set
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sonic_package_manager/manifest.py | Add type field to service manifest definition |
| sonic-utilities-data/templates/sonic.service.j2 | Conditionally include Type= directive |
Comments suppressed due to low confidence (4)
sonic_package_manager/manifest.py:206
- No unit tests have been added for the new
typefield unmarshalling; consider adding tests to verify default behavior and custom values are handled correctly.
ManifestField('type', DefaultMarshaller(str), ''),
sonic-utilities-data/templates/sonic.service.j2:28
- There are no template tests covering inclusion of the
Type=directive; add a template rendering test to verify correct conditional output.
{%- if manifest.service.type is defined and manifest.service.type %}
sonic_package_manager/manifest.py:206
- The
typefield value isn’t validated against allowed systemd service types; consider enforcing or documenting a whitelist (e.g., simple, notify, forking) to prevent invalid inputs.
ManifestField('type', DefaultMarshaller(str), ''),
sonic_package_manager/manifest.py:206
- The manifest schema documentation should be updated to explain the purpose, accepted values, and default behavior of the new
typefield.
ManifestField('type', DefaultMarshaller(str), ''),
qiluo-msft
approved these changes
Jul 14, 2025
Collaborator
|
Cherry-pick PR to 202505: #3974 |
YairRaviv
pushed a commit
to YairRaviv/sonic-utilities
that referenced
this pull request
Jan 12, 2026
…ifests (sonic-net#3946) What I did This change allows package developers to specify the systemd service type in their package manifests, which will be reflected in the generated systemd service files. How I did it Add optional 'type' field to service section in manifest schema Update sonic.service.j2 template to conditionally include Type= directive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
This change allows package developers to specify the systemd service type in their package manifests, which will be reflected in the generated systemd service files.
How I did it
How to verify it
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)