refactor(service/systemd): remove Debian SysVInit compatibility fallback - #562
Open
TheMeier wants to merge 1 commit into
Open
refactor(service/systemd): remove Debian SysVInit compatibility fallback#562TheMeier wants to merge 1 commit into
TheMeier wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the Debian SysVInit compatibility fallback from the systemd service provider, so enabled? relies solely on systemctl is-enabled results rather than inspecting init-script state via invoke-rc.d and rc.d start links.
Changes:
- Removed Debian-specific SysVInit enable-state probing (
invoke-rc.d+ rc.d link counting) from the systemd provider. - Simplified
enabled?behavior to return:falsefor non-zerosystemctl is-enabledexit codes (except for the existing masked/indirect handling). - Updated unit tests by removing Debian fallback expectations and deleting specs for the removed helper methods.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| spec/unit/provider/service/systemd_spec.rb | Removes tests that asserted Debian SysVInit fallback behavior and helper-method behavior that no longer exists. |
| lib/puppet/provider/service/systemd.rb | Removes debian_enabled? / get_start_link_count and the Debian fallback branch from enabled?. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The systemd provider no longer falls back to invoke-rc.d/init script inspection to determine whether a service is enabled. Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Comment on lines
343
to
347
| it "should consider nonexistent services to be disabled" do | ||
| provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist')) | ||
| allow(Facter).to receive(:value).with('os.family').and_return('debian') | ||
| expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'doesnotexist'], {:failonfail => false}) | ||
| .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1)) | ||
| expect(provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], {:failonfail => false}) | ||
| .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1)) | ||
|
|
| return ret if ret | ||
| end | ||
|
|
||
| :false |
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.
The systemd provider no longer falls back to invoke-rc.d/init script inspection to determine whether a service is enabled.
Short description
The systemd provider no longer falls back to invoke-rc.d/init script inspection to determine whether a service is enabled.
Checklist
I have:
Signed-off-byannotation to each of my commitsGenerated-byorAssisted-byannotations to each of my commits created with the help of an AI agent