Skip to content
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
5 changes: 3 additions & 2 deletions scripts/featured
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ class FeatureHandler(object):

# If feature has timer associated with it, start/enable corresponding systemd .timer unit
# otherwise, start/enable corresponding systemd .service unit

cmds.append(["sudo", "systemctl", "enable", "{}.{}".format(feature_name, feature_suffixes[-1])])
if unit_file_state != "generated":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This behavior looks fine functionally: generated units should not be enabled, and this still keeps the start path intact. Could you add one targeted unit test in tests/featured/featured_test.py for enable_feature() with get_systemd_unit_state() returning generated, asserting unmask and start are called but no systemctl enable command is issued?

# if UnitFileState of service file is generated, enable it will generate error
cmds.append(["sudo", "systemctl", "enable", "{}.{}".format(feature_name, feature_suffixes[-1])])
cmds.append(["sudo", "systemctl", "start", "{}.{}".format(feature_name, feature_suffixes[-1])])

for cmd in cmds:
Expand Down
Loading