class Chef::Knife::JoyentImageCreate

Public Instance Methods

image_create_options() click to toggle source
# File lib/chef/knife/joyent_image_create.rb, line 46
def image_create_options
  opts = {}
  opts["machine"] = config[:server] if config[:server]
  opts["name"] = config[:name] if config[:name]
  opts["version"] = config[:version] if config[:version]
  opts["description"] = config[:description] if config[:description]
  opts["eula"] = config[:eula] if config[:eula]
  opts["acl"] = config[:acl] if config[:acl]
  opts["tags"] = config[:tags] if config[:tags]
  opts
end
run() click to toggle source
# File lib/chef/knife/joyent_image_create.rb, line 58
def run
  # puts image_create_options.inspect
  res = self.connection.request(
    :method => "POST",
    :path => "/my/images",
    :body => image_create_options
  )
  if (res.status == 201)
    ui.info ui.color("Creating Image from server #{config[:server]}...", :cyan)
    ui.output(res.body)
  else
    output_error(res)
  end
end