Skip to content
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# How to contribute #

Third-party patches are essential for keeping Puppet great. We simply can't access the huge number of platforms and myriad configurations for running Puppet. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
Third-party patches are essential for keeping OpenVox great. We simply can't access the huge number of platforms and myriad configurations for running OpenVox. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.

## Adding New Facts ##

When adding new facts, they need to be added to the [schema](lib/schema/facter.yaml). The fact name, description, and type must be specified in the [schema](lib/schema/facter.yaml).

Learn more about how to contribute in our [Contribution Guidelines](https://github.com/puppetlabs/.github/blob/main/CONTRIBUTING.md).
Learn more about how to contribute in our [Contribution Documents](https://github.com/OpenVoxProject/.github/blob/main/CONTRIBUTING.md).
12 changes: 6 additions & 6 deletions Extensibility.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Extensibility
=============

Facter 4 has the following extensibility goals:
OpenFact has the following extensibility goals:

* Compatibility with 100% of existing Facter custom facts
* Compatibility with 100% of existing Facter external facts
Expand All @@ -13,13 +13,13 @@ Note that this doc is work-in-progress and should be updated as extensibility fe
Custom Facts Compatibility
--------------------------

Facter 4 will load custom facts from the following locations:
OpenFact will load custom facts from the following locations:

* Any Ruby source file in a `facter` subdirectory on the Ruby load path.
* Any Ruby source file in a directory specified by the `FACTERLIB` environment variable (delimited by the platform PATH separator).
* Any Ruby source file in a directory specified by the `--custom-dir` option to facter.

The following methods from the Facter API are currently supported by Facter 4:
The following methods from the Facter API are currently supported by OpenFact:

From the `Facter` module:

Expand Down Expand Up @@ -81,12 +81,12 @@ From the `Facter::Core::Aggregate` module:
* name
* on_flush

Please see the [Facter Custom Facts Walkthrough](https://puppet.com/docs/puppet/latest/custom_facts.html) for more information on using the Facter API.
Please see the [Custom Facts Walkthrough](https://docs.openvoxproject.org/openfact/latest/custom_facts.html) for more information on using the Facter API.

External Facts Compatiblity
---------------------------

Facter 4 supports all 4 forms of "external facts" which Facter 3 supports:
OpenFact supports all 4 forms of "external facts" which Facter 3 supports:
* JSON files with the .json extension whose key-value pairs will be mapped to fact-value pairs.
* YAML files with the .yaml extension whose key-value pairs will be mapped to fact-value pairs.
* Text files with the .txt extension containing `fact=some_value` strings
Expand All @@ -95,7 +95,7 @@ Facter 4 supports all 4 forms of "external facts" which Facter 3 supports:
Enable conversion of dotted facts to structured
---------------------------

By default Facter 4 treats the `.` in custom or external fact names as part of the fact name and not a delimiter for structured facts.
By default OpenFact treats the `.` in custom or external fact names as part of the fact name and not a delimiter for structured facts.

If you want to enable the new behaviour, that converts dotted facts to structured you need to set the following config:

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ used to inform conditional expressions in Puppet.

## Documentation

Documentation for the Facter project can be found on the [Puppet Docs
site](https://puppet.com/docs/puppet/latest/facter.html).
Documentation for OpenFact can be found on the [OpenVox Docs
site](https://docs.openvoxproject.org/openfact/latest/).

At the time of writing, the OpenVoxProject does not have a documentation website.
But your help is very welcome!
Your help improving the documentation is very welcome!
Reach out to the [Documentation Special Interest Group](https://github.com/voxpupuli/community-triage/wiki/SIG.Documentation) if you want to help.

## Supported platforms
Expand Down
2 changes: 1 addition & 1 deletion docs/data-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Generally, facter loads fact definitions (`LoadedFact`) to determine all of the

The `QueryParser` parse both user queries `a.b` and `c` and matches each query against all LoadedFacts, returning an array of `SearchedFacts`. These are more like SearchableFacts, since they haven't been searched yet.

Facter attempts to lookup the facts from the cache, otherwise it calls the `InternalFactManager` and `ExternalFactManager` to resolve facts.
OpenFact attempts to lookup the facts from the cache, otherwise it calls the `InternalFactManager` and `ExternalFactManager` to resolve facts.

For internal facts, facter wraps each `SearchedFact` with a `CoreFact`. The `CoreFact` calls the `call_the_resolver` method on the class that the `SearchedFact` references. The `call_the_resolver` method then typically delegates to a resolver and returns the fact value which may be scalar or structured data. For example, `os.family` returns a string, but `gce` returns a Hash.

Expand Down
8 changes: 4 additions & 4 deletions ext/project_data.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
project: 'facter'
author: 'Puppet Labs'
email: 'team-nw@puppet.com'
homepage: 'https://github.com/puppetlabs/facter'
summary: 'Facter, a system inventory tool'
author: 'OpenVox Project'
email: 'openvox@voxpupuli.org'
homepage: 'https://github.com/OpenVoxProject/openfact'
summary: 'OpenFact, a system inventory tool'
description: 'You can prove anything with facts!'
version_file: 'lib/facter/version.rb'
files: 'bin/facter lib/facter.rb lib/**/*.rb'
Expand Down
2 changes: 1 addition & 1 deletion lib/docs/template.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
### `<%= name %>`

<% if schema['hidden'] -%>
This legacy fact is hidden by default in Facter's command-line output.
This legacy fact is hidden by default in OpenFact's command-line output.

<% end -%>
**Type:** <%= schema['type'] %>
Expand Down
16 changes: 8 additions & 8 deletions lib/facter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ResolveCustomFactError < StandardError; end
@already_searched = {}

class << self
# Method used by puppet-agent to retrieve facts
# Method used by openvox-agent to retrieve facts
# @param args_as_string [string] facter cli arguments
#
# @return [Hash<String, Object>]
Expand Down Expand Up @@ -45,16 +45,16 @@ def resolve(args_as_string)
Hash[queried_facts(cli.args)]
end

# Method used by cli to set puppet paths
# in order to retrieve puppet custom and external facts
# Method used by cli to set OpenVox paths
# in order to retrieve OpenVox custom and external facts
#
# @return nil
#
# @api private
def puppet_facts
require 'puppet'

# don't allow puppet logger to be injected in Facter
# don't allow the OpenVox logger to be injected in OpenFact
Options[:allow_external_loggers] = false

Puppet.initialize_settings
Expand All @@ -69,7 +69,7 @@ def puppet_facts
end
end
rescue LoadError => e
logger.error("Could not load puppet gem, got #{e}")
logger.error("Could not load the openvox gem, got #{e}")
end

# Alias method for Facter.fact()
Expand Down Expand Up @@ -375,7 +375,7 @@ def search_path
# @api public
def to_hash
log_blocked_facts
logger.debug("Facter version: #{Facter::VERSION}")
logger.debug("OpenFact version: #{Facter::VERSION}")

resolved_facts = Facter::FactManager.instance.resolve_facts
resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }
Expand Down Expand Up @@ -439,7 +439,7 @@ def fact(user_query)
@already_searched[user_query]
end

# Returns Facter version
# Returns OpenFact version
#
# @return [String] Current version
#
Expand All @@ -456,7 +456,7 @@ def version
def to_user_output(cli_options, *args)
init_cli_options(cli_options)
logger.info("executed with command line: #{ARGV.drop(1).join(' ')}")
logger.debug("Facter version: #{Facter::VERSION}")
logger.debug("OpenFact version: #{Facter::VERSION}")
log_blocked_facts
resolved_facts = resolve_facts_for_user_query(args)
fact_formatter = Facter::FormatterFactory.build(Facter::Options.get)
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/custom_facts/util/directory_loader.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# A Facter plugin that loads external facts.
# An OpenFact plugin that loads external facts.
#
# Default Unix Directories:
# /opt/puppetlabs/custom_facts/facts.d, /etc/custom_facts/facts.d, /etc/puppetlabs/custom_facts/facts.d
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/framework/cli/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Cli < Thor
class_option :puppet,
type: :boolean,
aliases: '-p',
desc: 'Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.'
desc: 'Load the OpenVox libraries, thus allowing OpenFact to load OpenVox-specific facts.'

desc '--man', 'Display manual.', hide: true
map ['--man'] => :man
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/framework/config/config_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def fact_groups
def refresh_config(config_path)
@conf = File.readable?(config_path) ? Hocon.load(config_path) : {}
rescue StandardError => e
log.warn("Facter failed to read config file #{config_path} with the following error: #{e.message}")
log.warn("OpenFact failed to read config file #{config_path} with the following error: #{e.message}")
@conf = {}
end

Expand Down
4 changes: 2 additions & 2 deletions lib/facter/util/file_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def safe_readlines(path, default_return = [], sep = $/, chomp: false)

# This previously acted as a helper method for versions of Ruby older
# than 2.5, before Dir.children was added. As it isn't a private
# method, we can't remove it entirely until the next major Facter
# release (presumably Facter 5).
# method, we can't remove it entirely until the next major OpenFact
# release.
def dir_children(path)
Dir.children(path)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/schema/facter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

aio_agent_version:
type: string
description: Return the version of the puppet-agent package that installed facter.
description: Return the version of the openvox-agent package that installed facter.
resolution: |
All platforms: use the compile-time enabled version definition.

Expand Down Expand Up @@ -367,11 +367,11 @@ ec2_userdata:

env_windows_installdir:
type: string
description: Return the path of the directory in which Puppet was installed.
description: Return the path of the directory in which OpenVox was installed.
resolution: |
Windows: This fact is specific to the Windows MSI generated environment, and is
set using the `environment.bat` script that configures the runtime environment
for all Puppet executables. Please see [the original commit in the puppet_for_the_win repo](https://github.com/puppetlabs/puppet_for_the_win/commit/0cc32c1a09550c13d725b200d3c0cc17d93ec262) for more information.
for all OpenVox executables. Please see [the original commit in the puppet_for_the_win repo](https://github.com/puppetlabs/puppet_for_the_win/commit/0cc32c1a09550c13d725b200d3c0cc17d93ec262) for more information.
caveats: |
This fact is specific to Windows, and will not resolve on any other platform.

Expand Down
4 changes: 2 additions & 2 deletions man/man1/facter.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd Aug 22, 2025
.Dd Aug 01, 2026
.Dt FACTER 1
.Os
.Sh NAME
Expand Down Expand Up @@ -71,7 +71,7 @@ Resolve facts sequentially
.It Fl Fl http-debug
Whether to write HTTP request and responses to stderr. This should never be used in production.
.It Fl p , Fl Fl puppet
Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.
Load the OpenVox libraries, thus allowing OpenFact to load OpenVox-specific facts.
.El
.Sh FILES
.Bl -tag
Expand Down
4 changes: 2 additions & 2 deletions openfact.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

# While we require both ffi and sys-filesystem in parts of Facter, we specify
# While we require both ffi and sys-filesystem in parts of OpenFact, we specify
# them as development, not runtime, dependencies. Both gems either directly
# or indirectly contain native extensions. The intent behind excluding these
# gems from runtime dependencies is to allow users to be able to install
# Facter without a compiler.
# OpenFact without a compiler.
# ffi 1.16.0 - 1.16.2 are broken on Windows
spec.add_development_dependency 'ffi', '>= 1.15.5', '< 1.18.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2'
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
Expand Down
2 changes: 1 addition & 1 deletion spec/framework/config/config_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
end

it 'loggs a warning' do
expect(log).to receive(:warn).with(/Facter failed to read config file/)
expect(log).to receive(:warn).with(/OpenFact failed to read config file/)

config_reader.init
end
Expand Down
2 changes: 1 addition & 1 deletion tasks/manpages.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

desc 'Build Facter manpages'
desc 'Build OpenFact manpages'
task :gen_manpages do
require 'fileutils'

Expand Down