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

systemd-systemctl: Fix WantedBy processing #9

Open
wants to merge 1 commit into
base: kirkstone
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions meta/recipes-core/systemd/systemd-systemctl/systemctl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ locations = list()

class SystemdFile():
"""Class representing a single systemd configuration file"""

_clearable_keys = ['WantedBy']

def __init__(self, root, path, instance_unit_name):
self.sections = dict()
self._parse(root, path)
Expand Down Expand Up @@ -80,6 +83,14 @@ class SystemdFile():
v = m.group('value')
if k not in section:
section[k] = list()

# If we come across a "key=" line for a "clearable key", then
# forget all preceding assignments. This works because we are
# processing files in correct parse order.
if k in self._clearable_keys and not v:
del section[k]
continue

section[k].extend(v.split())

def get(self, section, prop):
Expand Down