Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created April 23, 2011 06:27
Show Gist options
  • Save jtimberman/938399 to your computer and use it in GitHub Desktop.
Save jtimberman/938399 to your computer and use it in GitHub Desktop.
Knife Plugin to list out Ubuntu EC2 AMIs provided by Canonical
require 'chef/knife'
module KnifePlugins
class Ec2AmisUbuntu < Chef::Knife
deps do
begin
require 'ubuntu_ami'
rescue LoadError
Chef::Log.error("Could not load Ubuntu AMI library.")
end
end
banner "knife ec2 amis ubuntu DISTRO [TYPE]"
def run
distro = name_args[0]
type = name_args[1]
ami_list = UbuntuAmi.new(distro).run[type] || UbuntuAmi.new(distro).run
output(format_for_display(ami_list))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment