Repository navigation
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1774.
cloudflared service install <token>on Linux deleted the token file whenever any later install step failed. When the service definition had already been generated (or was present from an earlier install), the enabled unit kept pointing at the missing token file and restarted in a loop, and re-running the install failed again at generating the definition, so the state could not be recovered by retrying.This removes the failure cleanup. The token file stays in place when an install fails, and
service uninstallremains the path that removes it; it already callsremoveTokenFileunconditionally. To make the behaviour testable, the install flow is split intoinstallLinuxServiceWith, which takes the config directory and the init-specific install step as parameters. The init dispatch itself is unchanged, moved intoinstallLinuxServiceForInit.Tests:
TestInstallLinuxServiceWithToken: an install failing at service-definition generation, an install failing at service start, and a successful install. The token file survives all three.TestRemoveTokenFile: uninstall still removes the token file, and removing a missing file is not an error.cmd/cloudflaredpackage test suite passes, as dogo vetandgofmton the changed files.Disclosure: PR #1787 attempted the same fix in a larger form and was closed by its author without maintainer review. This PR is a smaller take on the same change.
Note: the same failure-cleanup pattern exists in the macOS and Windows service installers. This PR only changes Linux, which is what #1774 reports.