# class Chef::Knife::ClientDelete

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/client_delete.rb, line 37
    def run
      @client_name = @name_args[0]

      if @client_name.nil?
        show_usage
        ui.fatal("You must specify a client name")
        exit 1
      end

      delete_object(Chef::ApiClient, @client_name, 'client') {
        object = Chef::ApiClient.load(@client_name)
        if object.validator
          unless config[:delete_validators]
            ui.fatal("You must specify --force to delete the validator client #{@client_name}")
            exit 2
          end
        end
        object.destroy
      }
    end