# class Chef::Knife::ClientReregister

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/client_reregister.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

      client = Chef::ApiClient.reregister(@client_name)
      Chef::Log.debug("Updated client data: #{client.inspect}")
      key = client.private_key
      if config[:file]
        File.open(config[:file], "w") do |f|
          f.print(key)
        end
      else
        ui.msg key
      end
    end