diff --git a/lib/facter/util/loader.rb b/lib/facter/util/loader.rb index 2d2d9e8a0e..b6aa8deb04 100644 --- a/lib/facter/util/loader.rb +++ b/lib/facter/util/loader.rb @@ -90,6 +90,7 @@ def load_env(fact = nil) next if fact and env_name != fact Facter.add($1) do + from_environment setcode { value } end diff --git a/lib/facter/util/resolution.rb b/lib/facter/util/resolution.rb index 4a99c35236..2ca2447bf6 100644 --- a/lib/facter/util/resolution.rb +++ b/lib/facter/util/resolution.rb @@ -85,17 +85,29 @@ def confine(confines) end end + # Say this resolution came from the environment + def from_environment + @from_environment = true + end + # Create a new resolution mechanism. def initialize(name) @name = name @confines = [] @value = nil @timeout = 0 + @from_environment = false end # Return the number of confines. def length - @confines.length + # If the resolution came from an environment variable + # say we're very very sure about the value of the resolution + if @from_environment + 1_000_000_000 + else + @confines.length + end end # We need this as a getter for 'timeout', because some versions