class Chef::Knife::UserKeyShow

Implements knife user key show using Chef::Knife::KeyShow as a service class.

@author Tyler Cloke

@attr_reader [String] actor the name of the client that this key is for

Attributes

actor[R]

Public Class Methods

new(argv = []) click to toggle source
Calls superclass method Chef::Knife::new
# File lib/chef/knife/user_key_show.rb, line 35
def initialize(argv = [])
  super(argv)
  @service_object = nil
end

Public Instance Methods

actor_missing_error() click to toggle source
# File lib/chef/knife/user_key_show.rb, line 49
def actor_missing_error
  "You must specify a user name"
end
apply_params!(params) click to toggle source
# File lib/chef/knife/user_key_show.rb, line 61
def apply_params!(params)
  @actor = params[0]
  if @actor.nil?
    show_usage
    ui.fatal(actor_missing_error)
    exit 1
  end
  @name = params[1]
  if @name.nil?
    show_usage
    ui.fatal(keyname_missing_error)
    exit 1
  end
end
keyname_missing_error() click to toggle source
# File lib/chef/knife/user_key_show.rb, line 53
def keyname_missing_error
  "You must specify a key name"
end
load_method() click to toggle source
# File lib/chef/knife/user_key_show.rb, line 45
def load_method
  :load_by_user
end
run() click to toggle source
# File lib/chef/knife/user_key_show.rb, line 40
def run
  apply_params!(@name_args)
  service_object.run
end
service_object() click to toggle source
# File lib/chef/knife/user_key_show.rb, line 57
def service_object
  @service_object ||= Chef::Knife::KeyShow.new(@name, @actor, load_method, ui)
end