Skip to content

[SPM] Add support for configuring systemd service Type in package manifests#3946

Merged
qiluo-msft merged 2 commits intosonic-net:masterfrom
DavidZagury:systemd_service_type
Jul 14, 2025
Merged

[SPM] Add support for configuring systemd service Type in package manifests#3946
qiluo-msft merged 2 commits intosonic-net:masterfrom
DavidZagury:systemd_service_type

Conversation

@DavidZagury
Copy link
Copy Markdown
Contributor

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

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)

…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.
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft requested a review from Copilot July 14, 2025 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds optional support for specifying the systemd service Type in package manifests and updates the service template accordingly.

  • Introduce a new type field in the manifest schema under service
  • Update sonic.service.j2 template to emit Type= when manifest.service.type is 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 type field 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 type field 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 type field.
            ManifestField('type', DefaultMarshaller(str), ''),

@qiluo-msft qiluo-msft merged commit c409594 into sonic-net:master Jul 14, 2025
7 checks passed
@mssonicbld
Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants