Please review pull request #45: (maint) Make noop logger work on Ruby 1.9.x opened by (kelseyhightower)
Description:
With out this patch the noop logger does not load on Ruby 1.9.x when
running Hiera from the CLI. Instead we get the follow error:
LoadError: cannot load such file -- hiera/noop_logger
This patch resolves this issue by moving the noop_logger definition frombin/hiera to lib/hiera/noop_logger.rb
- Opened: Wed Apr 25 14:15:06 UTC 2012
- Based on: puppetlabs:master (a2a8423ddca0376dbcbc1f55a706ac20a384c4c6)
- Requested merge: kelseyhightower:maint/master/make_noop_logger_work_on_ruby19 (b7b32806f8d17d0547137682a3cfbbe3d522386b)
Diff follows:
diff --git a/bin/hiera b/bin/hiera
index a441b1e..984d3ec 100755
--- a/bin/hiera
+++ b/bin/hiera
@@ -18,14 +18,14 @@ end
require 'hiera'
require 'optparse'
-options = {:default => nil, :config => "/etc/hiera.yaml", :scope => {}, :key => nil, :verbose => false, :resolution_type => :priority}
-
-class Hiera::Noop_logger
- class << self
- def warn(msg);end
- def debug(msg);end
- end
-end
+options = {
+ :default => nil,
+ :config => "/etc/hiera.yaml",
+ :scope => {},
+ :key => nil,
+ :verbose => false,
+ :resolution_type => :priority
+}
# Loads the scope from YAML or JSON files
def load_scope(source, type=:yaml)
diff --git a/lib/hiera.rb b/lib/hiera.rb
index c511d49..0cd5d0e 100644
--- a/lib/hiera.rb
+++ b/lib/hiera.rb
@@ -7,10 +7,11 @@
class Hiera
VERSION = "0.3.0"
- autoload :Config, "hiera/config"
- autoload :Backend, "hiera/backend"
+ autoload :Config, "hiera/config"
+ autoload :Backend, "hiera/backend"
autoload :Console_logger, "hiera/console_logger"
- autoload :Puppet_logger, "hiera/puppet_logger"
+ autoload :Puppet_logger, "hiera/puppet_logger"
+ autoload :Noop_logger, "hiera/noop_logger"
class << self
attr_reader :logger
diff --git a/lib/hiera/noop_logger.rb b/lib/hiera/noop_logger.rb
new file mode 100644
index 0000000..e6e4017
--- /dev/null
+++ b/lib/hiera/noop_logger.rb
@@ -0,0 +1,8 @@
+class Hiera
+ module Noop_logger
+ class << self
+ def warn(msg);end
+ def debug(msg);end
+ end
+ end
+end
diff --git a/lib/hiera/puppet_logger.rb b/lib/hiera/puppet_logger.rb
index 0e2c379..abe0b60 100644
--- a/lib/hiera/puppet_logger.rb
+++ b/lib/hiera/puppet_logger.rb
@@ -1,8 +1,13 @@
class Hiera
module Puppet_logger
class << self
- def warn(msg); Puppet.notice("hiera(): #{msg}"); end
- def debug(msg); Puppet.debug("hiera(): #{msg}"); end
+ def warn(msg)
+ Puppet.notice("hiera(): #{msg}")
+ end
+
+ def debug(msg)
+ Puppet.debug("hiera(): #{msg}")
+ end
end
end
end
-- 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.
