-
Notifications
You must be signed in to change notification settings - Fork 21
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: add packet-phone-home.service #107
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
systemd/system/multi-user.target.wants/packet-phone-home.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../packet-phone-home.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
ConditionKernelCommandLine=|ignition.platform.id=packet | ||
ConditionKernelCommandLine=|flatcar.oem.id=packet | ||
ConditionKernelCommandLine=|coreos.oem.id=packet | ||
|
||
Description=Report Success to Packet | ||
ConditionFirstBoot=true | ||
Wants=coreos-metadata.service | ||
After=coreos-metadata.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
EnvironmentFile=/run/metadata/flatcar | ||
ExecStart=/usr/bin/curl -fsSL --header "Content-Type: application/json" --request POST "${COREOS_PACKET_PHONE_HOME_URL}" | ||
Restart=on-failure | ||
RestartSec=2 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 should only run once
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.
Well, I think we should keep it as it was and let the service retries.
On QEMU, in the
cloudinit*
tests, we add in/etc
acoreos-metadata.service
which takes precedence over the one shipped in/usr
. Sincecloudinit
runs "late", the firstcoreos-metadata.service
required as a dependency of thepacket-phone-home
is started and this is one is failing because it actually wants to useafterburn
-> the dependency fails ->packet-phone-home.service
fails because of missing dependency (before evaluating theConditionKernelCommandLine
).We can't add a
ConditionKernelCommandLine=!flatcar.oem.id=qemu
on thecoreos-metadata.service
that we ship as this condition is not evaluated when the unit is a dependency of another one.EDIT: Moving from
Requires=coreos-metadata.service
toWants=coreos-metadata.service
should be enough.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.
The service should still retry with
RemainAfterExit=yes
andRestart=on-failure
, or?I'm a confused, why is this related to qemu? It would be good to fix any dependency issues -
Requires
actually makes sense here.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.
It does not retry as the failure is caused by systemd itself ("dependency failure"). It's related to QEMU because
qemu
is not a supported Afterburn platform, so the FIRST run ofcoreos-metadata
(the one from/usr
) is failing.Yes,
packet-phone-home
is not supposed to run on qemu, and this is the case, but the ConditionKernelCommandLine is evaluated only at the execution and not before when the service (and its dependencies) are queued.https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Conditions%20and%20Asserts
Requires
make sense but we haveEnvironmentFile
that actually makes fail the unit + it ensures that the unit run if the file is available.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.
Maybe we could still add conditions to
coreos-metadata.service
to prevent it from running. We know which platforms it supports and that would remove this unit failure from the logs.