Class: Chef::Knife::UserRekey

Inherits:
ChefWebui::Knife show all
Defined in:
lib/chef/knife/user_rekey.rb

Instance Method Summary collapse

Methods inherited from ChefWebui::Knife

common_options, #init_config_variable, #webui_session

Instance Method Details

#configure_chefObject


16
17
18
19
# File 'lib/chef/knife/user_rekey.rb', line 16

def configure_chef
  super
  init_config_variable(:key_file)
end

#runObject


21
22
23
24
25
26
27
28
29
30
# File 'lib/chef/knife/user_rekey.rb', line 21

def run
  if name_args.length == 0
    ui.error("Must specify organization name to create as the first argument, i.e. knife organization create ORGNAME")
    exit 1
  end
  webui_session.regenerate_validation_key(name_args[1])
  File.open(Chef::Config[:validator_key_file], 'w') do |file|
    file.write(validation_key)
  end
end