Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

(maint) Build absolute path for os hierarchy json. #481

Merged
merged 2 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/framework/detector/os_hierarchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Facter
class OsHierarchy
def initialize
@log = Log.new(self)
json_file = Util::FileHelper.safe_read('os_hierarchy.json')
json_file = Util::FileHelper.safe_read(File.join(ROOT_DIR, 'os_hierarchy.json'))

begin
@json_os_hierarchy = JSON.parse(json_file)
Expand Down
4 changes: 2 additions & 2 deletions spec/framework/detector/os_hierarchy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
before do
allow(Facter::Util::FileHelper)
.to receive(:safe_read)
.with('os_hierarchy.json')
.with(File.join(ROOT_DIR, 'os_hierarchy.json'))
.and_return(load_fixture('os_hierarchy').read)
allow(Facter::Log).to receive(:new).and_return(log)
end
Expand All @@ -18,7 +18,7 @@
before do
allow(Facter::Util::FileHelper)
.to receive(:safe_read)
.with('os_hierarchy.json')
.with(File.join(ROOT_DIR, 'os_hierarchy.json'))
.and_return(load_fixture('broken_os_hierarchy').read)
end

Expand Down