class Chef::Knife::OscUserReregister

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/osc_user_reregister.rb, line 42
def run
  @user_name = @name_args[0]

  if @user_name.nil?
    show_usage
    ui.fatal("You must specify a user name")
    exit 1
  end

  user = Chef::User.load(@user_name).reregister
  Chef::Log.trace("Updated user data: #{user.inspect}")
  key = user.private_key
  if config[:file]
    File.open(config[:file], "w") do |f|
      f.print(key)
    end
  else
    ui.msg key
  end
end