Sha256: 710361090fb48f2f27a3e8b408180475175b092f77b35a83982199d16658cac2

Contents?: true

Size: 727 Bytes

Versions: 15

Compression:

Stored size: 727 Bytes

Contents

require 'chef/knife/joyent_base'

class Chef
  class Knife
    class JoyentKeyDelete < Knife

      include Knife::JoyentBase

      banner "knife joyent key delete <name>"

      def run
        unless name_args.size === 1
          show_usage
        end

        keyname = name_args.first

        begin
          self.connection.delete_key(keyname)
        rescue Excon::Errors::NotFound => e
          ui.error("Key [#{keyname}] does not exist.")
          exit 1
        rescue Excon::Errors::Conflict => e
          body = MultiJson.decode(e.response.body)
          ui.error(body["message"])
          exit 1
        end

        puts ui.color('Deleted key: '+keyname, :cyan)
        exit 0
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
knife-joyent-0.4.0 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.6 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.5 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.4 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.3 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.2 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.1 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.3.0 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.2.2 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.2.1 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.2.0 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.1.4 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.1.3 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.1.1 lib/chef/knife/joyent_key_delete.rb
knife-joyent-0.1.0 lib/chef/knife/joyent_key_delete.rb