Class: Chef::Knife::EcKeyExport
Instance Method Summary
collapse
Methods included from EcKeyBase
#db, included, #load_config_from_file!
Instance Method Details
#export(path) ⇒ Object
39
40
41
42
|
# File 'lib/chef/knife/ec_key_export.rb', line 39
def export(path)
users = db.select(:username, :public_key, :pubkey_version, :hashed_password, :salt, :hash_type).from(:users)
File.open(path, 'w') { |file| file.write(users.all.to_json) }
end
|
#run ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/chef/knife/ec_key_export.rb', line 30
def run
if config[:sql_user].nil? || config[:sql_password].nil?
load_config_from_file!
end
path = @name_args[0] || "key_dump.json"
export(path)
end
|