Class: Chef::Knife::KeyShow
- Inherits:
-
Object
- Object
- Chef::Knife::KeyShow
- Defined in:
- lib/chef/knife/key_show.rb
Overview
Service class for UserKeyShow and ClientKeyShow, used to show keys. Implements common functionality of knife [user | org client] key show.
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #display_output(key) ⇒ Object
-
#initialize(name, actor, load_method, ui) ⇒ KeyShow
constructor
A new instance of KeyShow.
- #run ⇒ Object
Constructor Details
#initialize(name, actor, load_method, ui) ⇒ KeyShow
Returns a new instance of KeyShow.
35 36 37 38 39 40 |
# 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 |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
33 34 35 |
# File 'lib/chef/knife/key_show.rb', line 33 def config @config end |
Instance Method Details
#display_output(key) ⇒ Object
42 43 44 |
# File 'lib/chef/knife/key_show.rb', line 42 def display_output(key) @ui.output(@ui.format_for_display(key)) end |
#run ⇒ Object
46 47 48 49 50 |
# 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 |