Module: Chef::Knife::API::Support

Defined in:
lib/knife/api.rb

Overview

adding Support module

Class Method Summary collapse

Class Method Details

.run_knife(command, args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/knife/api.rb', line 11

def self.run_knife(command, args)
  unless command.is_a?(Array)
    command = command.to_s.split(/[\s_]+/)
  end

  command += args

  if ENV['CHEF_CONFIG']
    command += ['-c', ENV['CHEF_CONFIG']]
  end

  opts = Chef::Application::Knife.new.options
  Chef::Knife.run(command, opts)
  return 0
rescue SystemExit => e
  return e.status
end