-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix use of legacy facts Fixes #301 * Add missing tests for uid_min fact
- Loading branch information
Showing
18 changed files
with
125 additions
and
75 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
* Mon Dec 30 2024 Steven Pritchard <[email protected]> - 4.14.0 | ||
- Fix use of legacy facts (#301) | ||
|
||
* Mon Dec 23 2024 Steven Pritchard <[email protected]> - 4.13.0 | ||
- Refactor and cleanup for rubocop | ||
|
||
|
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,56 @@ | ||
require 'spec_helper' | ||
|
||
describe 'uid_min', type: :fact do | ||
subject(:fact) { Facter.fact(:uid_min) } | ||
|
||
before(:each) do | ||
Facter.clear | ||
|
||
allow(File).to receive(:exist?).and_call_original | ||
allow(File).to receive(:read).and_call_original | ||
end | ||
|
||
context 'when /etc/login.defs does not exist' do | ||
before(:each) do | ||
allow(File).to receive(:exist?).with('/etc/login.defs').and_return(false) | ||
end | ||
|
||
it 'returns nil' do | ||
expect(fact.value).to be_nil | ||
end | ||
end | ||
|
||
context 'when /etc/login.defs exists' do | ||
before(:each) do | ||
allow(File).to receive(:exist?).with('/etc/login.defs').and_return(true) | ||
end | ||
|
||
context 'when /etc/login.defs is empty' do | ||
before(:each) do | ||
allow(File).to receive(:read).with('/etc/login.defs').and_return('') | ||
end | ||
|
||
it 'returns default value' do | ||
expect(fact.value).to eq('1000') | ||
end | ||
end | ||
|
||
context 'when /etc/login.defs has matching lines' do | ||
let(:login_defs_content) do | ||
<<~EOM | ||
#UID_MIN ??? | ||
# UID_MIN 500 | ||
UID_MIN 10000 | ||
EOM | ||
end | ||
|
||
before(:each) do | ||
allow(File).to receive(:read).with('/etc/login.defs').and_return(login_defs_content) | ||
end | ||
|
||
it 'returns expected value' do | ||
expect(fact.value).to eq('10000') | ||
end | ||
end | ||
end | ||
end |