Skip to content

Commit

Permalink
Closes #2 knife joyent tag list <server>
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Chan committed Apr 11, 2012
1 parent 8125c7c commit c7b32dc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lib/knife-joyent/joyent_tag_list.rb
@@ -0,0 +1,35 @@
require File.expand_path(File.dirname(__FILE__) + '/base')

module KnifeJoyent
class JoyentTagList < Chef::Knife

include KnifeJoyent::Base

banner "knife joyent tag list <server>"

def run
server = name_args.first

unless server
show_usage
exit 1
end

tags = [
ui.color('Name', :bold),
ui.color('Value', :bold),
]

self.connection.servers.get(server).tags.each do |k, v|
tags << k
tags << v
end

puts ui.list(tags, :uneven_columns_across, 2)
exit 0
rescue Excon::Errors::NotFound => e
puts ui.error("Server #{server} not found")
exit 1
end
end
end

0 comments on commit c7b32dc

Please sign in to comment.