Class: KnifeSharp::SharpHistory
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- KnifeSharp::SharpHistory
- Defined in:
- lib/chef/knife/sharp-history.rb
Constant Summary collapse
- @@cfg_files =
[ "/etc/sharp-config.yml", "~/.chef/sharp-config.yml" ]
Instance Method Summary collapse
Instance Method Details
#load_config ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chef/knife/sharp-history.rb', line 22 def load_config loaded = false @@cfg_files.each do |cfg_file| begin @@cfg=YAML::load_file(File.(cfg_file)) loaded = true rescue Exception => e puts "Error on loading config : #{e.inspect}" if config[:debug] end end unless loaded == true ui.error "config could not be loaded ! Tried the following files : #{@@cfg_files.join(", ")}" exit 1 end puts @@cfg.inspect if config[:debug] end |
#run ⇒ Object
39 40 41 42 |
# File 'lib/chef/knife/sharp-history.rb', line 39 def run load_config() show_logs() end |
#show_logs ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/chef/knife/sharp-history.rb', line 44 def show_logs() begin fp = File.open(File.(@@cfg["logging"]["destination"]), "r") fp.readlines.each do |line| puts line end rescue Exception => e ui.error "oops ! #{e.inspect}" end end |