class ChefEc2NodeRm::Knife

Public Class Methods

new(command) click to toggle source
# File lib/chef_ec2_node_rm/knife.rb, line 5
def initialize(command)
  @command = "knife #{command} --format json"
end

Public Instance Methods

run() click to toggle source
# File lib/chef_ec2_node_rm/knife.rb, line 9
def run
  logger.debug("Knife command: #{@command}")
  result = `#{@command}`
  result_parsed = begin
    JSON.parse(result)
  rescue JSON::ParserError
    result
  end
  logger.debug("Knife output: #{result_parsed}")
  result_parsed
end