before: define my_name, my_email, lab, then store into ES and config yaml after: query my_name, my_email, lab, my_token from ES, then config yaml
[why] store account info into ES, this part will do in other registry service, so when start auto-submit service, no need to store data, only query ES and config yaml.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sbin/auto_submit | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/sbin/auto_submit b/sbin/auto_submit index 5648d59..359a462 100755 --- a/sbin/auto_submit +++ b/sbin/auto_submit @@ -86,15 +86,26 @@ 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 query_account_info + my_email = 'auto-submit@localhost' + + option = ESQuery.new(index: 'accounts').query_by_id(my_email) + raise "query auto-submit account info failed: #{my_email}" unless option + + option +end + +def config_yaml + option = query_account_info + + build_my_info = BuildMyInfo.new(option['my_email'], option['my_name'], option['lab'], option['my_token']) + build_my_info.config_default_yaml + build_my_info.config_lab_yaml +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 +query_account_info +config_yaml
auto_submitter = AutoSubmit.new auto_submitter.listen