
On Tue, Oct 20, 2020 at 11:36:32AM +0800, Luan Shengde wrote:
add parameters for answerback-email -e,--email email_addr: add email address -s,--ssh-pubkey pub_key: add a ssh login pub_key -f,--raw-email mail_file: add email address[, pub_key] via email file
why: easier for administrator to manully assign jumper account for user with: - user's email - user's email and a pub_key - user's email_file
Signed-off-by: Luan Shengde <luanshengde2@huawei.com> --- container/assign-account/answerback-email.rb | 173 ++++++++----------- 1 file changed, 74 insertions(+), 99 deletions(-)
diff --git a/container/assign-account/answerback-email.rb b/container/assign-account/answerback-email.rb index b5283ba..5a5234c 100755 --- a/container/assign-account/answerback-email.rb +++ b/container/assign-account/answerback-email.rb @@ -3,46 +3,18 @@ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # frozen_string_literal: true
-=begin - -repo_list: - all repos url list from upstream-repos.git - -API: -call graph: -read_mail_content -send_account_request - email_addr - get email address - email_message_id - get email message_id - check_email_available - check email available - pub_key_value - get pub key - account - send apply account request and return account info - build_message - build email message - send_mail - call send_mail to send mail whit build message - -the returned data for account_info like: -{ - "account" => "guest", - "passwd" => "Use pub_key to login", - "jumper_ip" => "10.10.10.10", - "jumper_port" => "10000" -} -=end +# xx --email xxx --login --ssh-pubkey xxx --raw-email email-file +# samba mount +# ssh logshn (huawei, ) (install pubkey / send password)
require 'json' require 'mail' require 'set' -require_relative '../defconfig.rb' +require 'optparse' +require_relative '../defconfig'
names = Set.new %w[ - JUMPER_IP + JUMPER_HOST JUMPER_PORT CRYSTAL_INTRANET SEND_MAIL_PORT @@ -50,27 +22,71 @@ names = Set.new %w[
defaults = relevant_defaults(names)
-JUMPER_IP = defaults['JUMPER_IP'] -JUMPER_PORT = defaults['JUMPER_PORT'] -CRYSTAL_INTRANET = defaults['CRYSTAL_INTRANET'] -SEND_MAIL_PORT = defaults['SEND_MAIL_PORT'] +JUMPER_HOST = defaults['JUMPER_HOST'] || '183.134.196.212' +JUMPER_PORT = defaults['JUMPER_PORT'] || 29999 +CRYSTAL_INTRANET = defaults['CRYSTAL_INTRANET'] || localhost
不应该有CRYSTAL_字样
+SEND_MAIL_PORT = defaults['SEND_MAIL_PORT'] || 11312 + +apply_info = { + 'email_addr' => nil,
my_email?
+ 'pub_key' => nil
ditto Why not use standard var names consistently throughout our project? Thanks, Fengguang