On Wed, Feb 24, 2021 at 03:20:36PM +0800, Wu Fengguang wrote:
+4.需要对输出的error_id中含有的特殊字符进行处理。
- 单引号,空格,冒号等
- 定义一个白名单。名单之外的字符,统统替换为'-'.
- 各种数字,统统替换为'#'.
- 连续的-, #替换为单个
Got it.
Thanks, Chenglong
- def common_error_id(line)
- line = line.chomp
- line.gsub!(/ /, '-')
- line.gsub!(/:/, '') # error.:-'__mysql_packages'-is-undefined: 1
- line.gsub!(/,/, '')
- line.gsub!(/'/, '') # Failed-to-download-metadata-for-repo-'dockerrepo: 1
- line.gsub!(/!/, '') # Distribution-openEuler-is-not-supported-by-this-role!: 1
- line.gsub!(/{%/, ' ')
- line.gsub!(/%}/, ' ')
- line
- end
-- 2.23.0