Class: KnifeNodeContextExec::ContextExec
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- KnifeNodeContextExec::ContextExec
- Defined in:
- lib/chef/knife/context_exec.rb
Overview
The knife
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/chef/knife/context_exec.rb', line 49 def run puts "knife context exec #{KnifeNodeContextExec::VERSION}" environment = config[:environment].to_s node_query = config[:node_query].to_s directory = config[:directory].to_s template_filename = config[:template_filename].to_s script_filename = config[:script_filename].to_s command = config[:command].to_s filter_regex = config[:filter_regex].to_s parallel = config[:parallel] raise 'Some parameters are missing' if environment.empty? || node_query.empty? || directory.empty? || template_filename.empty? || script_filename.empty? || command.empty? || filter_regex.empty? directory = File.(directory) template_filename = File.(template_filename) puts "Environment: #{environment}" puts "Query: #{node_query}" puts "Directory: #{directory}" puts "Template: #{template_filename}" puts "Script: #{script_filename}" puts "Command: #{command}" puts "Regex: #{filter_regex}" puts "Parallel? #{parallel}" nodes = Chef::Search::Query.new.search(:node, node_query).first.select do |node| node.environment == environment end nodes.each { |node| puts "Found #{node.name}" } KnifeNodeContextExec.run(nodes, directory, template_filename, script_filename, command, filter_regex, parallel, false) end |