diff options
| author | Paul Nasrat <pnasrat@googlemail.com> | 2009-09-05 21:35:01 +0100 |
|---|---|---|
| committer | Paul Nasrat <pnasrat@googlemail.com> | 2009-09-09 15:19:46 +0100 |
| commit | bfe8a2a9e7a03c2a09273ef74d59e2843f5359ae (patch) | |
| tree | a4b1c400a74e47ab8056095d919ca8fc58e5fa64 /lib | |
| parent | 49470cf776f2c23cabec00b68b85a1264a3f7b48 (diff) | |
| download | facter-bfe8a2a9e7a03c2a09273ef74d59e2843f5359ae.tar.gz facter-bfe8a2a9e7a03c2a09273ef74d59e2843f5359ae.tar.xz facter-bfe8a2a9e7a03c2a09273ef74d59e2843f5359ae.zip | |
Fix 2455 - improve error handling on fact load
Fix facts added with empty blocks by handling calls to value when setcode not called
Ensure we handle load failures more gracefully
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/facter/util/loader.rb | 6 | ||||
| -rw-r--r-- | lib/facter/util/resolution.rb | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/facter/util/loader.rb b/lib/facter/util/loader.rb index c6013cc..ac90c48 100644 --- a/lib/facter/util/loader.rb +++ b/lib/facter/util/loader.rb @@ -69,7 +69,11 @@ class Facter::Util::Loader def load_file(file) # We have to specify Kernel.load, because we have a load method. - Kernel.load(file) + begin + Kernel.load(file) + rescue ScriptError => detail + warn "Error loading fact #{file} #{detail}" + end end # Load facts from the environment. If no name is provided, diff --git a/lib/facter/util/resolution.rb b/lib/facter/util/resolution.rb index 04d5e47..b9e28e8 100644 --- a/lib/facter/util/resolution.rb +++ b/lib/facter/util/resolution.rb @@ -111,6 +111,7 @@ class Facter::Util::Resolution # How we get a value for our resolution mechanism. def value result = nil + return result if @code == nil and @interpreter == nil begin Timeout.timeout(limit) do if @code.is_a?(Proc) |
