-
Notifications
You must be signed in to change notification settings - Fork 109
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.unit.create: support the After option in the Unit section (HMS-3814) #1741
Conversation
Support the After option in the Unit section of the unit file.
Add test values for Wants, Requires, and After. Adding multiple values to test that arrays work and made sure they're all different. The units need to be valid, real unit names otherwise the 'systemd-analyze verify' check will fail.
Quite cool addition 🧡 |
Needs one more fix. The |
The change in cd79140 makes the The test manifest in
|
1315b62
to
73a894b
Compare
I ended up removing the I kept a version of some of the things I tried for getting it right here: main...achilleas-k:osbuild:systemd-after-verify-stuff The summary is that it gets very tricky to verify user units in a non-booted system. We could skip verification only for user units, but it feels weird to have it only for certain situations. User unit verification did work for me when I would bind mount the build root's If anyone feels strongly about adding the verification back, I can add it with the |
3a1fcfc
to
4053242
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very nice, thank you! Some small suggestion inline but feel free to ignore if you disagree/prefer the other way.
4053242
to
d999ba7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Verifying the systemd unit also checks if any referred systemd units (Wants, Requires, After) exist and if all commands in Exec exist and are executable. Without '--root', the systemd-analyze verify command is testing this against files in the build root, which isn't valid. Units and binaries might not exist in the build root when referenced in the image root tree, making the unit fail when when it's valid. Conversely, the verification can succeed by finding executables in the build root that don't exist in the image root tree when it should be failing. When verifying user units, systemd expects runtime directories. All of this makes it quite difficult to verify systemd units properly when building an image. The call is useful for making sure the unit is structured properly, but the user unit verification setup is difficult to accomplish in a general way while building. Remove the systemd-analyze verify step from the stage. Move it to the unit test so that we have some assurance that our unit file structure is correct and things work as expected. Create referenced unit files and commands to make the unit valid.
d999ba7
to
b8520ba
Compare
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
Update osbuild commit ID to include osbuild/osbuild#1741
stage/systemd.unit.create: add After option
Support the After option in the Unit section of the unit file.
test/systemd_unit_create: Wants, Requires, After
Add test values for Wants, Requires, and After.
Adding multiple values to test that arrays work and made sure they're
all different.
The units need to be valid, real unit names otherwise the
'systemd-analyze verify' check will fail.
stage/systemd.unit.create: move systemd-analyze verify to tests
Verifying the systemd unit also checks if any referred systemd units
(Wants, Requires, After) exist and if all commands in Exec exist and are
executable. Without '--root', the systemd-analyze verify command is
testing this against files in the build root, which isn't valid.
Units and binaries might not exist in the build root when referenced in
the image root tree, making the unit fail when when it's valid.
Conversely, the verification can succeed by finding executables in the
build root that don't exist in the image root tree when it should be
failing.
When verifying user units, systemd expects runtime directories.
All of this makes it quite difficult to verify systemd units properly
when building an image. The call is useful for making sure the unit is
structured properly, but the user unit verification setup is difficult
to accomplish in a general way while building.
Remove the systemd-analyze verify step from the stage. Move it to the
unit test so that we have some assurance that our unit file structure is
correct and things work as expected. Create referenced unit files and
commands to make the unit valid.