You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raise"Failed to fetch ErrorCodes wiki page: #{response.code}#{response.message}"
50
+
end
51
+
52
+
data=JSON.parse(response.body)
53
+
text=data.dig('wiki_page','text') || ''
54
+
55
+
# Parse lines like: * [[ERF12-1234]] - Error message here
56
+
error_codes={}
57
+
text.each_linedo |line|
58
+
ifline =~ /\*\[\[([^\]]+)\]\] - (.+)$/
59
+
code=Regexp.last_match(1)
60
+
message=Regexp.last_match(2).strip
61
+
error_codes[code]=message
62
+
end
63
+
end
64
+
65
+
error_codes
66
+
end
67
+
68
+
defcollect_error_codes
5
69
exceptions=[
6
70
'Foreman::Exception',
7
71
'WrappedException',
@@ -18,8 +82,58 @@ namespace :exception do
18
82
end
19
83
end
20
84
21
-
result.sort.eachdo |k,v|
22
-
puts" * [[#{k}]] - #{v}"
85
+
result.sort
86
+
end
87
+
88
+
defgenerate_error_codes_list
89
+
error_codes=collect_error_codes
90
+
91
+
template=ERB.new(<<~TEMPLATE,trim_mode: '-')
92
+
<% error_codes.each do |code, message| -%>
93
+
* [[<%= code %>]] - <%= message %>
94
+
<% end -%>
95
+
TEMPLATE
96
+
97
+
template.result(binding)
98
+
end
99
+
100
+
defgenerate_error_codes_wiki_content(error_codes)
101
+
template=ERB.new(<<~TEMPLATE,trim_mode: '-')
102
+
h1. Foreman error codes
103
+
104
+
Most error messages in Foreman include error code. Find additional information by clicking on individual codes on this page.
105
+
106
+
If you have an ERF12-* error, do check [[Proxy_communication_errors]] first for SSL or communication errors, which aren't specific to particular proxy actions.
0 commit comments