class Chef::Knife::JoyentSnapshotList
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/joyent_snapshot_list.rb, line 11 def run unless name_args.size == 1 show_usage exit 1 end server = name_args.first snapshots = [ ui.color('ID', :bold), ui.color('State', :bold), ui.color('Created', :bold), ] self.connection.snapshots.all(server).each do |s| snapshots << ui.color(s.name, :bold) snapshots << case s.state when "queued" then ui.color(s.state, :yellow) when "success" then ui.color(s.state, :green) else ui.color(s.state.to_s, :red) end snapshots << s.created.to_s end puts ui.list(snapshots, :uneven_columns_across, 3) rescue e output_error(e) end