module Chef::Knife::TidyBase
Public Class Methods
included(includer)
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 24 def self.included(includer) includer.class_eval do deps do require_relative "../tidy_server" require_relative "../tidy_common" end option :org_list, long: "--orgs ORG1,ORG2", description: "Only apply to objects in the named organizations" end end
Public Instance Methods
action_needed(msg, file_path = action_needed_file_path)
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 70 def action_needed(msg, file_path = action_needed_file_path) ::File.open(file_path, "a") do |f| f.write(msg + "\n") end end
action_needed_file_path()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 62 def action_needed_file_path ::File.expand_path("knife-tidy-actions-needed.txt") end
completion_message()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 58 def completion_message ui.stdout.puts ui.color("** Finished **", :magenta).to_s end
rest()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 46 def rest @rest ||= Chef::ServerAPI.new(server.root_url, keepalives: true) end
server()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 37 def server @server ||= if Chef::Config.chef_server_root.nil? ui.warn("chef_server_root not found in knife configuration; using chef_server_url") Chef::TidyServer.from_chef_server_url(Chef::Config.chef_server_url) else Chef::TidyServer.new(Chef::Config.chef_server_root) end end
server_warnings_file_path()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 66 def server_warnings_file_path ::File.expand_path("reports/knife-tidy-server-warnings.txt") end
tidy()
click to toggle source
# File lib/chef/knife/tidy_base.rb, line 50 def tidy @tidy ||= if config[:backup_path].nil? Chef::TidyCommon.new else Chef::TidyCommon.new(config[:backup_path]) end end