lib/gogetit/util.rb in gogetit-0.3.0 vs lib/gogetit/util.rb in gogetit-0.4.0

- old
+ new

@@ -2,11 +2,12 @@ require 'net/ssh' require 'active_support/core_ext/hash' module Gogetit module Util - def knife_bootstrap(name, type, config) + def knife_bootstrap(name, type, config, logger) + logger.info("Calling <#{__method__.to_s}>") if find_executable 'knife' if system('knife ssl check') install_cmd = "curl \ -l #{config[:chef][:bootstrap][:install_script][type.to_sym]} \ | sudo bash -s --" @@ -20,11 +21,12 @@ system(knife_cmd) end end end - def update_vault(config) + def update_vault(config, logger) + logger.info("Calling <#{__method__.to_s}>") # It assumes the data_bags directory is under the root directory of Chef Repo data_bags_dir = "#{config[:chef][:chef_repo_root]}/data_bags" (Dir.entries("#{data_bags_dir}") - ['.', '..']).each do |bag| (Dir.entries("#{data_bags_dir}/#{bag}").select do |f| /^((?!keys).)*\.json/.match(f) @@ -40,11 +42,12 @@ puts update_cmd system(update_cmd) end end - def knife_remove(name) + def knife_remove(name, logger) + logger.info("Calling <#{__method__.to_s}>") if find_executable 'knife' if system('knife ssl check') puts "Deleting node #{name}.." system("knife node delete -y #{name}") puts "Deleting client #{name}.." @@ -89,9 +92,10 @@ thing end end def wait_until_available(fqdn, logger) + logger.info("Calling <#{__method__.to_s}>") until ping_available?(fqdn, logger) logger.info("Calling <#{__method__.to_s}> for ping to be ready..") sleep 3 end logger.info("#{fqdn} is now available to ping..")