Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Systemd::Unit type stricter #290

Merged
merged 3 commits into from
Jul 4, 2022
Merged

Conversation

traylenator
Copy link
Contributor

Pull Request (PR) description

Previously lots of unit names like

this is a service with spaces in.service

were permitted for instance.

From systemd.unit

Valid unit names consist of a "name prefix" and a dot and a suffix specifying the unit type. The "unit prefix" must consist of one or more valid characters (ASCII letters, digits, ":", "-", "_", ".", and ""). The total length of the unit name including the suffix must not exceed 256 characters. The type suffix must be one of ".service", ".socket", ".device", ".mount", ".automount", ".swap", ".target", ".path", ".timer", ".slice", or ".scope".

in addition we allow @ to cover the case of template or template instance.

Previously lots of unit names like

```
this is a service with spaces in.service
```
were permitted for instance.

From systemd.unit

> Valid unit names consist of a "name prefix" and a dot and a suffix specifying the unit type. The "unit prefix" must consist of one or more valid characters (ASCII letters, digits, ":", "-", "_", ".", and "\"). The total length of the unit name including the suffix must not exceed 256 characters. The type suffix must be one of ".service", ".socket", ".device", ".mount", ".automount", ".swap", ".target", ".path", ".timer", ".slice", or ".scope".

in addition we allow `@` to cover the case of template or template
instance.
@traylenator traylenator added the enhancement New feature or request label Jul 1, 2022
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Small suggestion to simplify, otherwise 👍

types/unit.pp Outdated Show resolved Hide resolved
Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
REFERENCE.md Outdated Show resolved Hide resolved
@ekohl ekohl merged commit d9d99c3 into voxpupuli:master Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants