class Chef::Knife::KeyShow

Service class for UserKeyShow and ClientKeyShow, used to show keys. Implements common functionality of knife [user | org client] key show.

@author Tyler Cloke

@attr_accessor [Hash] cli input, see UserKeyShow and ClientKeyShow for what could populate it

Attributes

config[RW]

Public Class Methods

new(name, actor, load_method, ui) click to toggle source
# File lib/chef/knife/key_show.rb, line 35
def initialize(name, actor, load_method, ui)
  @name = name
  @actor = actor
  @load_method = load_method
  @ui = ui
end

Public Instance Methods

display_output(key) click to toggle source
# File lib/chef/knife/key_show.rb, line 42
def display_output(key)
  @ui.output(@ui.format_for_display(key))
end
run() click to toggle source
# File lib/chef/knife/key_show.rb, line 46
def run
  key = Chef::Key.send(@load_method, @actor, @name)
  key.public_key(key.public_key.strip)
  display_output(key)
end