14 lines
339 B
Ruby
14 lines
339 B
Ruby
# frozen_string_literal: true
|
|
|
|
Facter.add('enc_env') do
|
|
setcode do
|
|
require 'yaml'
|
|
# Check if the YAML file exists
|
|
if File.exist?('/root/.cache/custom_facts.yaml')
|
|
data = YAML.load_file('/root/.cache/custom_facts.yaml')
|
|
# Use safe navigation to return 'enc_env' or nil
|
|
data&.dig('enc_env')
|
|
end
|
|
end
|
|
end
|