class Chef::Knife::ClientKeyCreate

Implements knife user key create using Chef::Knife::KeyCreate 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/client_key_create.rb, line 41
def initialize(argv = [])
  super(argv)
  @service_object = nil
end

Public Instance Methods

actor_field_name() click to toggle source
# File lib/chef/knife/client_key_create.rb, line 51
def actor_field_name
  "client"
end
actor_missing_error() click to toggle source
# File lib/chef/knife/client_key_create.rb, line 59
def actor_missing_error
  "You must specify a client name"
end
apply_params!(params) click to toggle source
# File lib/chef/knife/client_key_create.rb, line 63
def apply_params!(params)
  @actor = params[0]
  if @actor.nil?
    show_usage
    ui.fatal(actor_missing_error)
    exit 1
  end
end
run() click to toggle source
# File lib/chef/knife/client_key_create.rb, line 46
def run
  apply_params!(@name_args)
  service_object.run
end
service_object() click to toggle source
# File lib/chef/knife/client_key_create.rb, line 55
def service_object
  @service_object ||= Chef::Knife::KeyCreate.new(@actor, actor_field_name, ui, config)
end