[how] before: define my_name, my_email, lab, then store into ES and config yaml after: find my_name, my_email from /etc/compass-ci/register/*.yaml, then config yaml
[why] store account info into ES, this part already done by container service register-accounts, so when start auto-submit service, no need to store data, only config yaml.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sbin/auto_submit | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/sbin/auto_submit b/sbin/auto_submit index 5648d59..c59deb7 100755 --- a/sbin/auto_submit +++ b/sbin/auto_submit @@ -6,7 +6,9 @@ require 'bunny' require 'json' require 'yaml' +require 'set' require_relative '../lib/build_my_info_client' +require "#{ENV['CCI_SRC']}/container/defconfig"
# receive message and auto submit job class AutoSubmit @@ -86,15 +88,23 @@ class AutoSubmit end end
-option = { - my_name: 'Auto Submit Robot', - my_email: 'autosubmit@localhost', - lab: `awk '/^lab:\s/ {print $2; exit}' /etc/compass-ci/defaults/*.yaml`.chomp -} +def my_email + names = Set.new %w[auto-submit] + + defaults = relevant_defaults(names) + defaults['auto-submit']['my_email'] +end + +def config_yaml + build_my_info = BuildMyInfo.new(my_email) + + my_info = build_my_info.search_my_info + build_my_info.config_default_yaml(my_info) + build_my_info.config_lab_yaml(my_info) +end
# fix verification problems when submit jobs by auto-submit service -build_my_info = BuildMyInfo.new(option[:my_email], option[:my_name], option[:lab]) -build_my_info.config_my_info +config_yaml
auto_submitter = AutoSubmit.new auto_submitter.listen