Sha256: 6cae8818f0b1e0f20fc256a5d974a5fcea6132266fcdf2b18e5078be98e14532

Contents?: true

Size: 984 Bytes

Versions: 11

Compression:

Stored size: 984 Bytes

Contents

require 'chef/knife/joyent_base'

class Chef
  class Knife
    class JoyentSnapshotList < Knife

      include Knife::JoyentBase

      banner "knife joyent snapshot list <server_id>"

      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
knife-joyent-0.4.14 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.12 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.11 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.10 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.9 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.8 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.5 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.4 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.3 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.2 lib/chef/knife/joyent_snapshot_list.rb
knife-joyent-0.4.1 lib/chef/knife/joyent_snapshot_list.rb