From: Nicolas Szalay <[email protected]> Handle exceptions when trying to parse the classes file and log a warning level message.
Signed-off-by: R.I.Pienaar <[email protected]> --- Local-branch: bug/master/7627 lib/mcollective/util.rb | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/mcollective/util.rb b/lib/mcollective/util.rb index dde8944..bc7c9f3 100644 --- a/lib/mcollective/util.rb +++ b/lib/mcollective/util.rb @@ -33,12 +33,16 @@ module MCollective Log.debug("Looking for configuration management classes in #{cfile}") - File.readlines(cfile).each do |k| - if klass.is_a?(Regexp) - return true if k.chomp.match(klass) - else - return true if k.chomp == klass + begin + File.readlines(cfile).each do |k| + if klass.is_a?(Regexp) + return true if k.chomp.match(klass) + else + return true if k.chomp == klass + end end + rescue + Log.warn("Could not open #{cfile} for configuration management classes lookup") end false -- 1.7.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
