[why] request is: when user submit jobs, the ssh keys are already there.
Signed-off-by: Luan Shengde shdluan@163.com --- container/assign-account/answerback-email.rb | 10 ++-------- container/assign-account/get_account_info.rb | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/container/assign-account/answerback-email.rb b/container/assign-account/answerback-email.rb index 766e1b3..21285e7 100755 --- a/container/assign-account/answerback-email.rb +++ b/container/assign-account/answerback-email.rb @@ -61,7 +61,6 @@ stdin_info = {} email_info = {} my_info_es = {} conf_info = { - 'gen_sshkey' => false, 'enable_login' => true, 'is_update_account' => false } @@ -83,13 +82,12 @@ end
options = OptionParser.new do |opts| opts.banner = 'Usage: answerback-mail.rb [-e|--email email] [-n|--name name] ' - opts.banner += "[-s|--ssh-pubkey pub_key_file] [-g|--gen-sshkey] [-l|--login y|n] [-u|--update]\n" + opts.banner += "[-s|--ssh-pubkey pub_key_file] [-l|--login y|n] [-u|--update]\n" opts.banner += ' answerback-mail.rb [-f|--raw-email email_file] ' - opts.banner += "[-g|--gen-sshkey] [--login y|n] [--update]\n" + opts.banner += "[--login y|n] [--update]\n" opts.banner += " -e|-f is required when applying account or updating account\n" opts.banner += " -n is required when assigning account with -e\n" opts.banner += " -s is optional when use -e\n" - opts.banner += " -g is optional, used to generate sshkey for user\n" opts.banner += " -u is required when updating an account\n" opts.banner += ' -l is optional, used to enable/disable login permission'
@@ -141,10 +139,6 @@ options = OptionParser.new do |opts| init_info(mail_content, email_info, my_info, my_info_es) end
- opts.on('-g', '--gen-sshkey', 'generate jumper rsa public/private key and return pubkey') do - conf_info['gen_sshkey'] = true - end - opts.on('-u', '--update', 'updata configurations') do conf_info['is_update_account'] = true end diff --git a/container/assign-account/get_account_info.rb b/container/assign-account/get_account_info.rb index 9a7acda..5096734 100755 --- a/container/assign-account/get_account_info.rb +++ b/container/assign-account/get_account_info.rb @@ -64,7 +64,7 @@ class AccountStorage
def read_account_info available_dir = File.join(@account_dir, 'available-users') - files = Dir.entries(available_dir) + files = Dir.open(available_dir).to_a files -= ['.', '..']
message = 'no more available users' @@ -112,9 +112,7 @@ class AccountStorage config_authorized_key(login_name) config_yaml(login_name) permit_login_config(login_name) - if @data.key?('gen_sshkey') && @data['gen_sshkey'] - my_jumper_pubkey = generate_ssh_key(login_name) - end + my_jumper_pubkey = generate_ssh_key(login_name)
jumper_account_info = { 'my_login_name' => login_name,