On Sat, Feb 20, 2021 at 11:29:31AM +0800, Wang Chenglong wrote:
[How] ansible_stats_openeuler < ${job_output}
Signed-off-by: Wang Chenglong 18509160991@163.com
stats/ansible_test | 135 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 124 insertions(+), 11 deletions(-)
diff --git a/stats/ansible_test b/stats/ansible_test index 4c7d07b3e..bd60a3ebc 100755 --- a/stats/ansible_test +++ b/stats/ansible_test @@ -1,15 +1,128 @@ #!/usr/bin/env ruby
-while (line = STDIN.gets)
- case line.chomp!
- when /ok=(\d+)\s+changed=(\d+)\s+unreachable=(\d+)\s+failed=(\d+)\s+skipped=(\d+)\s+rescued=(\d+)\s+ignored=(\d+)/
- puts "ansible_test.total.nr_ok: #{$1}"
- puts "ansible_test.total.nr_changed: #{$2}"
- puts "ansible_test.total.nr_failed: #{$4}"
- puts "ansible_test.total.nr_skipped: #{$5}"
- puts "ansible_test.total.nr_rescued: #{$6}"
- puts "ansible_test.total.nr_ignored: #{$7}"
- when /playbook_run_on_fail/
- puts line
+require 'json'
xxxx() { id = common_error_id $1 puts id: 1 puts id.message: $1 }
+def parse_msg_1(ansible_failed_json)
- case ansible_failed_json.chomp
- # When running some plug-in, the file was not found
- when /(No file was found when using .+)./
xxxx $1
- puts "files.error.no-file-was-found-when-using.#{$1}: 1"
- puts "files.error.no-file-was-found-when-using.#{$1}.message: #{@ansible_failed_info}"
- # {"changed": false, "cmd": "csf -v", "msg": "[Errno 2] No such file or directory: b'csf': b'csf'", "rc": 2}
- when /No such file or directory: b (.+) :/
- # The task includes an option with an undefined variable
- when /: (.+) is undefined/
xxxx $1
Thanks, Fengguang