[why] key my_uuid is renamed to my_token
Signed-off-by: Luan Shengde shdluan@163.com --- container/mail-robot/lib/apply-account.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/container/mail-robot/lib/apply-account.rb b/container/mail-robot/lib/apply-account.rb index 0fff3b5..93920f4 100755 --- a/container/mail-robot/lib/apply-account.rb +++ b/container/mail-robot/lib/apply-account.rb @@ -31,6 +31,7 @@ SEND_MAIL_PORT = ENV['SEND_MAIL_PORT'] || 49000 # - my_email # - my_name # - my_uuid +# - my_token # my_ssh_pubkey # store_account_info # call ESClient to store my_info @@ -38,6 +39,7 @@ SEND_MAIL_PORT = ENV['SEND_MAIL_PORT'] || 49000 # - my_email # - my_name # - my_uuid +# - my_token # - my_commit_url # - my_login_name # - my_ssh_pubkey @@ -62,6 +64,7 @@ class ApplyAccount # in order to successfully send email for failed parsing # firstly get my_email before execute parse_mail_content is needed @my_info['my_email'] = @mail_content.from[0] + @my_info['lab'] = ENV['lab'] parse_mail_content apply_my_account
@@ -92,14 +95,17 @@ class ApplyAccount apply_info = {} if my_account_es my_ssh_pubkey_new = @my_info.delete('my_ssh_pubkey') + # my_token will take the place of my_uuid. + # to make the change with no sense, will keep the my_uuid for now + apply_info['my_token'] = my_account_es['my_uuid'] if my_account_es['my_token'].nil? apply_info.update my_account_es apply_info.update @my_info apply_info['my_ssh_pubkey'] = (apply_info['my_ssh_pubkey'] + my_ssh_pubkey_new).uniq @my_info.update apply_info apply_info['is_update_account'] = true else - my_uuid = %x(uuidgen).chomp - @my_info['my_uuid'] = my_uuid + my_token = %x(uuidgen).chomp + @my_info['my_token'] = my_token apply_info.update @my_info end apply_new_account(apply_info, my_account_es) @@ -112,10 +118,6 @@ class ApplyAccount @my_info['my_login_name'] = acct_info['my_login_name'] unless my_account_es end
- def check_account_es - ESQuery.new(index: 'accounts').query_by_id(@my_info['my_email']) - end - def store_account_info es = ESClient.new(index: 'accounts') es.put_source_by_id(@my_info['my_email'], @my_info)