[PATCH compass-ci 5/5] user-client/maintain: send report mail

use send-mail service to mail. Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- user-client/maintain/walk-os-test/walk-os-iperf-test | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index 7ed07c5..f65959d 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze EMAIL_ADDRESS = (ENV['USER']).to_s.freeze +def send_mail + message = File.read(LOG).chomp + data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'" + + %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}") +end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

On Fri, Nov 27, 2020 at 02:39:52PM +0800, Liu Yinsi wrote:
use send-mail service to mail.
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- user-client/maintain/walk-os-test/walk-os-iperf-test | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index 7ed07c5..f65959d 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze
EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail + message = File.read(LOG).chomp
^----- how to get "LOG"?
+ data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'"
why to be different between "#{EMAIL_ADDRESS}" and "'#{message}'"? Thanks, Liushaofei
+ %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}") +end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail + message = File.read(LOG).chomp
^----- how to get "LOG"?
in first patch have define LOG = 'walk-test.report', job result will write into walk-test.report.
+ data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'"
why to be different between "#{EMAIL_ADDRESS}" and "'#{message}'"?
no different, i will remove ''. Thanks, Yinsi
Thanks, Liushaofei
+ %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}") +end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

On Fri, Nov 27, 2020 at 02:39:52PM +0800, Liu Yinsi wrote:
use send-mail service to mail.
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- user-client/maintain/walk-os-test/walk-os-iperf-test | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index 7ed07c5..f65959d 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze
EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail + message = File.read(LOG).chomp + data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'" + + %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}")
11311 => LOCAL_SEND_MAIL_PORT May be you can use mail_client.rb in lib. Thanks, Xueliang
+end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

@@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze
EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail + message = File.read(LOG).chomp + data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'" + + %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}")
11311 => LOCAL_SEND_MAIL_PORT
May be you can use mail_client.rb in lib.
good Thanks, Yinsi
Thanks, Xueliang
+end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

On Fri, Nov 27, 2020 at 02:39:52PM +0800, Liu Yinsi wrote:
use send-mail service to mail.
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- user-client/maintain/walk-os-test/walk-os-iperf-test | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index 7ed07c5..f65959d 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze
EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail + message = File.read(LOG).chomp + data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'" + + %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}")
^^^ the port is fixed? Thanks, Shenwei
+end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0

+ data = " + subject: os rootfs test report + to: #{EMAIL_ADDRESS} + body: '#{message}'" + + %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}")
good Thanks, Yinsi
^^^ the port is fixed?
Thanks, Shenwei
+end + def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0
participants (4)
-
Cao Xueliang
-
Liu Shaofei
-
Liu Yinsi
-
Xiao Shenwei