foreman_remote_execution 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.babelrc +9 -0
- data/.eslintignore +3 -0
- data/.eslintrc +49 -0
- data/.gitignore +1 -0
- data/.hound.yml +5 -0
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +63 -35
- data/.travis.yml +6 -0
- data/app/assets/javascripts/foreman_remote_execution/template_invocation.js +1 -1
- data/app/assets/stylesheets/foreman_remote_execution/job_invocations.css.scss +0 -14
- data/app/controllers/job_invocations_controller.rb +18 -0
- data/app/helpers/job_invocations_chart_helper.rb +77 -0
- data/app/helpers/job_invocations_helper.rb +79 -0
- data/app/helpers/remote_execution_helper.rb +10 -50
- data/app/models/job_invocation.rb +4 -0
- data/app/models/remote_execution_provider.rb +4 -0
- data/app/views/job_invocations/_card_results.html.erb +11 -0
- data/app/views/job_invocations/_card_schedule.html.erb +32 -0
- data/app/views/job_invocations/_card_target_hosts.html.erb +33 -0
- data/app/views/job_invocations/_card_user_input.html.erb +16 -0
- data/app/views/job_invocations/_tab_hosts.html.erb +1 -1
- data/app/views/job_invocations/_tab_overview.html.erb +25 -55
- data/app/views/job_invocations/_tab_preview_templates.html.erb +20 -0
- data/app/views/job_invocations/_user_input.html.erb +21 -0
- data/app/views/job_invocations/show.html.erb +14 -8
- data/app/views/job_invocations/show.js.erb +3 -6
- data/config/routes.rb +1 -0
- data/lib/foreman_remote_execution/engine.rb +2 -2
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/package.json +62 -0
- data/test/unit/job_invocation_test.rb +15 -0
- data/webpack/index.js +29 -0
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.js +34 -0
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js +36 -0
- data/webpack/react_app/components/jobInvocations/index.js +58 -0
- data/webpack/react_app/redux/actions/jobInvocations/index.js +74 -0
- data/webpack/react_app/redux/consts.js +6 -0
- data/webpack/react_app/redux/reducers/index.js +6 -0
- data/webpack/react_app/redux/reducers/jobInvocations/index.fixtures.js +78 -0
- data/webpack/react_app/redux/reducers/jobInvocations/index.js +32 -0
- data/webpack/react_app/redux/reducers/jobInvocations/index.test.js +37 -0
- data/webpack/test_setup.js +11 -0
- metadata +26 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fcd52aa2585b165caee15553d3ceaaf4fc5cf69
|
4
|
+
data.tar.gz: d22298a49fa2ddc29e0d5c5ea022716461ecf527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf01f416ab54076ae74f0e13aead95fa68604e6600bac1df9936991e65e3e24fbcfaf8f97ade5c68bcb3a6b25701e27368071bed6de27a31a13b59e875e13756
|
7
|
+
data.tar.gz: 3283109dbb5554f722c00bcf8632e9513521641354afcc1f86484e0eefc74da05797fd70bd522b0e95d68ead7a1b28767d9e86e18f4e1da292aa1f9ecf4f8ba3
|
data/.babelrc
ADDED
data/.eslintignore
ADDED
data/.eslintrc
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"root": true,
|
3
|
+
"extends": "airbnb-base",
|
4
|
+
"plugins": [
|
5
|
+
"react"
|
6
|
+
],
|
7
|
+
"env": {
|
8
|
+
"browser": true,
|
9
|
+
"es6": true,
|
10
|
+
"node": true,
|
11
|
+
"jasmine": true,
|
12
|
+
"jest": true
|
13
|
+
},
|
14
|
+
"globals": {
|
15
|
+
"document": false,
|
16
|
+
"escape": false,
|
17
|
+
"navigator": false,
|
18
|
+
"unescape": false,
|
19
|
+
"window": false,
|
20
|
+
"$": true,
|
21
|
+
"_": true,
|
22
|
+
"__": true
|
23
|
+
},
|
24
|
+
"parser": "babel-eslint",
|
25
|
+
"rules": {
|
26
|
+
"react/jsx-uses-vars": "error",
|
27
|
+
"react/jsx-uses-react": "error",
|
28
|
+
"no-unused-vars": [
|
29
|
+
"error",
|
30
|
+
{
|
31
|
+
"vars": "all",
|
32
|
+
"args": "none"
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"no-underscore-dangle": "off",
|
36
|
+
"no-use-before-define": "off",
|
37
|
+
"import/prefer-default-export": "off",
|
38
|
+
"import/no-extraneous-dependencies": [
|
39
|
+
"error",
|
40
|
+
{
|
41
|
+
// Allow importing devDependencies like @storybook
|
42
|
+
"devDependencies": true
|
43
|
+
}
|
44
|
+
],
|
45
|
+
// Import rules off for now due to HoundCI issue
|
46
|
+
"import/no-unresolved": "off",
|
47
|
+
"import/extensions": "off"
|
48
|
+
}
|
49
|
+
}
|
data/.gitignore
CHANGED
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 0`
|
3
|
-
# on
|
3
|
+
# on 2018-04-02 18:24:49 +0200 using RuboCop version 0.54.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -13,7 +13,7 @@
|
|
13
13
|
Gemspec/OrderedDependencies:
|
14
14
|
Enabled: false
|
15
15
|
|
16
|
-
# Offense count:
|
16
|
+
# Offense count: 17
|
17
17
|
# Cop supports --auto-correct.
|
18
18
|
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
19
19
|
# SupportedStyles: case, end
|
@@ -25,22 +25,17 @@ Layout/CaseIndentation:
|
|
25
25
|
Layout/EmptyLines:
|
26
26
|
Enabled: false
|
27
27
|
|
28
|
-
# Offense count:
|
29
|
-
# Cop supports --auto-correct.
|
30
|
-
Layout/EmptyLinesAroundArguments:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
# Offense count: 8
|
28
|
+
# Offense count: 7
|
34
29
|
# Cop supports --auto-correct.
|
35
30
|
# Configuration parameters: EnforcedStyle.
|
36
31
|
# SupportedStyles: empty_lines, no_empty_lines
|
37
32
|
Layout/EmptyLinesAroundBlockBody:
|
38
33
|
Enabled: false
|
39
34
|
|
40
|
-
# Offense count:
|
35
|
+
# Offense count: 20
|
41
36
|
# Cop supports --auto-correct.
|
42
37
|
# Configuration parameters: EnforcedStyle.
|
43
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
38
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
44
39
|
Layout/EmptyLinesAroundClassBody:
|
45
40
|
Enabled: false
|
46
41
|
|
@@ -51,12 +46,6 @@ Layout/EmptyLinesAroundClassBody:
|
|
51
46
|
Layout/EmptyLinesAroundModuleBody:
|
52
47
|
Enabled: false
|
53
48
|
|
54
|
-
# Offense count: 907
|
55
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
56
|
-
# URISchemes: http, https
|
57
|
-
Metrics/LineLength:
|
58
|
-
Max: 204
|
59
|
-
|
60
49
|
# Offense count: 1
|
61
50
|
# Cop supports --auto-correct.
|
62
51
|
# Configuration parameters: Width, IgnoredPatterns.
|
@@ -70,7 +59,7 @@ Layout/IndentationWidth:
|
|
70
59
|
Layout/MultilineOperationIndentation:
|
71
60
|
Enabled: false
|
72
61
|
|
73
|
-
# Offense count:
|
62
|
+
# Offense count: 1
|
74
63
|
# Cop supports --auto-correct.
|
75
64
|
Layout/SpaceAfterComma:
|
76
65
|
Enabled: false
|
@@ -81,7 +70,7 @@ Layout/SpaceAfterComma:
|
|
81
70
|
Layout/SpaceAroundOperators:
|
82
71
|
Enabled: false
|
83
72
|
|
84
|
-
# Offense count:
|
73
|
+
# Offense count: 46
|
85
74
|
# Cop supports --auto-correct.
|
86
75
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
87
76
|
# SupportedStyles: space, no_space, compact
|
@@ -89,7 +78,7 @@ Layout/SpaceAroundOperators:
|
|
89
78
|
Layout/SpaceInsideArrayLiteralBrackets:
|
90
79
|
Enabled: false
|
91
80
|
|
92
|
-
# Offense count:
|
81
|
+
# Offense count: 85
|
93
82
|
# Cop supports --auto-correct.
|
94
83
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
95
84
|
# SupportedStyles: space, no_space, compact
|
@@ -97,18 +86,28 @@ Layout/SpaceInsideArrayLiteralBrackets:
|
|
97
86
|
Layout/SpaceInsideHashLiteralBraces:
|
98
87
|
Enabled: false
|
99
88
|
|
100
|
-
# Offense count:
|
89
|
+
# Offense count: 5
|
101
90
|
# Configuration parameters: MaximumRangeSize.
|
102
91
|
Lint/MissingCopEnableDirective:
|
103
92
|
Enabled: false
|
104
93
|
|
105
|
-
# Offense count:
|
94
|
+
# Offense count: 1
|
95
|
+
# Cop supports --auto-correct.
|
96
|
+
Lint/UnneededCopDisableDirective:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# Offense count: 1
|
100
|
+
# Cop supports --auto-correct.
|
101
|
+
Lint/UnneededCopEnableDirective:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# Offense count: 10
|
106
105
|
# Cop supports --auto-correct.
|
107
106
|
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
108
107
|
Lint/UnusedBlockArgument:
|
109
108
|
Enabled: false
|
110
109
|
|
111
|
-
# Offense count:
|
110
|
+
# Offense count: 14
|
112
111
|
# Cop supports --auto-correct.
|
113
112
|
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
114
113
|
Lint/UnusedMethodArgument:
|
@@ -118,21 +117,45 @@ Lint/UnusedMethodArgument:
|
|
118
117
|
Lint/UselessAssignment:
|
119
118
|
Enabled: false
|
120
119
|
|
121
|
-
# Offense count:
|
122
|
-
Metrics/AbcSize:
|
123
|
-
Max: 40
|
124
|
-
|
125
|
-
# Offense count: 3
|
120
|
+
# Offense count: 5
|
126
121
|
Metrics/CyclomaticComplexity:
|
127
122
|
Max: 8
|
128
123
|
|
124
|
+
# Offense count: 940
|
125
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
126
|
+
# URISchemes: http, https
|
127
|
+
Metrics/LineLength:
|
128
|
+
Max: 204
|
129
|
+
|
130
|
+
# Offense count: 2
|
131
|
+
Naming/MemoizedInstanceVariableName:
|
132
|
+
Enabled: false
|
133
|
+
|
134
|
+
# Offense count: 3
|
135
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
136
|
+
# AllowedNames: io, id, to
|
137
|
+
Naming/UncommunicativeMethodParamName:
|
138
|
+
Enabled: false
|
139
|
+
|
140
|
+
# Offense count: 15
|
141
|
+
# Cop supports --auto-correct.
|
142
|
+
Rails/ActiveRecordAliases:
|
143
|
+
Enabled: false
|
144
|
+
|
129
145
|
# Offense count: 7
|
130
146
|
# Configuration parameters: Include.
|
131
147
|
# Include: db/migrate/*.rb
|
132
148
|
Rails/CreateTableWithTimestamps:
|
133
149
|
Enabled: false
|
134
150
|
|
135
|
-
# Offense count:
|
151
|
+
# Offense count: 1
|
152
|
+
# Cop supports --auto-correct.
|
153
|
+
# Configuration parameters: EnforcedStyle.
|
154
|
+
# SupportedStyles: numeric, symbolic
|
155
|
+
Rails/HttpStatus:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
# Offense count: 23
|
136
159
|
# Configuration parameters: Include.
|
137
160
|
# Include: app/models/**/*.rb
|
138
161
|
Rails/InverseOf:
|
@@ -144,7 +167,7 @@ Rails/InverseOf:
|
|
144
167
|
Rails/LexicallyScopedActionFilter:
|
145
168
|
Enabled: false
|
146
169
|
|
147
|
-
# Offense count:
|
170
|
+
# Offense count: 1
|
148
171
|
# Cop supports --auto-correct.
|
149
172
|
Rails/Presence:
|
150
173
|
Enabled: false
|
@@ -171,20 +194,25 @@ Style/DoubleNegation:
|
|
171
194
|
Style/Encoding:
|
172
195
|
Enabled: false
|
173
196
|
|
174
|
-
# Offense count:
|
197
|
+
# Offense count: 7
|
198
|
+
# Cop supports --auto-correct.
|
199
|
+
Style/ExpandPathArguments:
|
200
|
+
Enabled: false
|
201
|
+
|
202
|
+
# Offense count: 15
|
175
203
|
# Configuration parameters: EnforcedStyle.
|
176
204
|
# SupportedStyles: annotated, template, unannotated
|
177
205
|
Style/FormatStringToken:
|
178
206
|
Enabled: false
|
179
207
|
|
180
|
-
# Offense count:
|
208
|
+
# Offense count: 1527
|
181
209
|
# Cop supports --auto-correct.
|
182
210
|
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
183
211
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
184
212
|
Style/HashSyntax:
|
185
213
|
Enabled: false
|
186
214
|
|
187
|
-
# Offense count:
|
215
|
+
# Offense count: 17
|
188
216
|
# Cop supports --auto-correct.
|
189
217
|
Style/IfUnlessModifier:
|
190
218
|
Enabled: false
|
@@ -194,7 +222,7 @@ Style/IfUnlessModifier:
|
|
194
222
|
Style/LineEndConcatenation:
|
195
223
|
Enabled: false
|
196
224
|
|
197
|
-
# Offense count:
|
225
|
+
# Offense count: 22
|
198
226
|
# Cop supports --auto-correct.
|
199
227
|
# Configuration parameters: PreferredDelimiters.
|
200
228
|
Style/PercentLiteralDelimiters:
|
@@ -213,14 +241,14 @@ Style/RaiseArgs:
|
|
213
241
|
Style/RedundantReturn:
|
214
242
|
Enabled: false
|
215
243
|
|
216
|
-
# Offense count:
|
244
|
+
# Offense count: 5
|
217
245
|
# Cop supports --auto-correct.
|
218
246
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
219
247
|
# SupportedStyles: single_quotes, double_quotes
|
220
248
|
Style/StringLiterals:
|
221
249
|
Enabled: false
|
222
250
|
|
223
|
-
# Offense count:
|
251
|
+
# Offense count: 2
|
224
252
|
# Cop supports --auto-correct.
|
225
253
|
# Configuration parameters: IgnoredMethods.
|
226
254
|
# IgnoredMethods: respond_to, define_method
|
data/.travis.yml
ADDED
@@ -91,7 +91,7 @@ function delayed_refresh(url, data){
|
|
91
91
|
url: url,
|
92
92
|
data: data,
|
93
93
|
dataType: "script",
|
94
|
-
error: function() { $("div
|
94
|
+
error: function() { $("div#job-invocation-chart").append('<div class="line error">' + __('There was an error while updating the status, try refreshing the page.') + '</div>'); }
|
95
95
|
}
|
96
96
|
)
|
97
97
|
}, 1000);
|
@@ -1,7 +1,3 @@
|
|
1
|
-
div#status_chart {
|
2
|
-
float: right;
|
3
|
-
}
|
4
|
-
|
5
1
|
div.infoblock {
|
6
2
|
margin-bottom: 20px;
|
7
3
|
line-height: 2;
|
@@ -9,14 +5,4 @@ div.infoblock {
|
|
9
5
|
pre {
|
10
6
|
margin-top: 5px;
|
11
7
|
}
|
12
|
-
|
13
|
-
div.host_counter {
|
14
|
-
float: left;
|
15
|
-
min-width: 100px;
|
16
|
-
text-align: center;
|
17
|
-
|
18
|
-
.count {
|
19
|
-
font-size: 20px;
|
20
|
-
}
|
21
|
-
}
|
22
8
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class JobInvocationsController < ApplicationController
|
2
2
|
include ::Foreman::Controller::AutoCompleteSearch
|
3
3
|
include ::ForemanTasks::Concerns::Parameters::Triggering
|
4
|
+
include ::JobInvocationsChartHelper
|
5
|
+
|
4
6
|
|
5
7
|
def new
|
6
8
|
return @composer = prepare_composer if params[:feature].present?
|
@@ -62,6 +64,20 @@ class JobInvocationsController < ApplicationController
|
|
62
64
|
@composer = prepare_composer
|
63
65
|
end
|
64
66
|
|
67
|
+
def chart
|
68
|
+
find_resource
|
69
|
+
render :json => {
|
70
|
+
:finished => @job_invocation.finished?,
|
71
|
+
:job_invocations => job_invocation_data(@job_invocation)[:columns],
|
72
|
+
:statuses => {
|
73
|
+
:success => @job_invocation.progress_report[:success],
|
74
|
+
:cancelled => @job_invocation.progress_report[:cancelled],
|
75
|
+
:failed => @job_invocation.progress_report[:error],
|
76
|
+
:pending => @job_invocation.progress_report[:pending]
|
77
|
+
},
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
65
81
|
def preview_hosts
|
66
82
|
composer = prepare_composer
|
67
83
|
|
@@ -103,6 +119,8 @@ class JobInvocationsController < ApplicationController
|
|
103
119
|
'create'
|
104
120
|
when 'cancel'
|
105
121
|
'cancel'
|
122
|
+
when 'chart'
|
123
|
+
'view'
|
106
124
|
else
|
107
125
|
super
|
108
126
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal:true
|
2
|
+
|
3
|
+
module JobInvocationsChartHelper
|
4
|
+
def job_invocation_chart(invocation)
|
5
|
+
donut_chart('#status_chart',
|
6
|
+
job_invocation_data(invocation)[:columns],
|
7
|
+
job_invocation_data(invocation)[:groups])
|
8
|
+
end
|
9
|
+
|
10
|
+
def job_invocation_data(invocation)
|
11
|
+
return @job_invocation_data if @job_invocation_data.present?
|
12
|
+
progress_report = invocation.progress_report
|
13
|
+
success = progress_report[:success]
|
14
|
+
cancelled = progress_report[:cancelled]
|
15
|
+
failed = progress_report[:error]
|
16
|
+
pending = progress_report[:pending]
|
17
|
+
columns = [[_('Success'), success, '#5CB85C'],
|
18
|
+
[_('Failed'), failed, '#D9534F'],
|
19
|
+
[_('Pending'), pending, '#DEDEDE'],
|
20
|
+
[_('Cancelled'), cancelled, '#B7312D']]
|
21
|
+
groups = [columns.map(&:first)]
|
22
|
+
|
23
|
+
@job_invocation_data = { :columns => columns, :groups => groups}
|
24
|
+
end
|
25
|
+
|
26
|
+
def job_invocation_status(invocation, percent = nil, verbose = true)
|
27
|
+
case invocation.status
|
28
|
+
when HostStatus::ExecutionStatus::QUEUED
|
29
|
+
if verbose && invocation.task
|
30
|
+
_('queued to start executing in %{time}') % {:time => time_ago_in_words(invocation.task.start_at) }
|
31
|
+
else
|
32
|
+
_('queued')
|
33
|
+
end
|
34
|
+
when HostStatus::ExecutionStatus::RUNNING
|
35
|
+
percent ||= invocation.progress_report[:progress]
|
36
|
+
_('running %{percent}%%') % {:percent => percent}
|
37
|
+
when HostStatus::ExecutionStatus::OK
|
38
|
+
_('succeeded')
|
39
|
+
when HostStatus::ExecutionStatus::ERROR
|
40
|
+
_('failed')
|
41
|
+
else
|
42
|
+
_('unknown status')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def job_invocation_success_status
|
47
|
+
icon_text('ok',
|
48
|
+
@job_invocation_data[0][1],
|
49
|
+
:kind => 'pficon')
|
50
|
+
end
|
51
|
+
|
52
|
+
def job_invocation_failed_status
|
53
|
+
icon_text('error-circle-o',
|
54
|
+
@job_invocation_data[1][1],
|
55
|
+
:kind => 'pficon')
|
56
|
+
end
|
57
|
+
|
58
|
+
def job_invocation_pending_status
|
59
|
+
icon_text('running',
|
60
|
+
@job_invocation_data[2][1],
|
61
|
+
:kind => 'pficon')
|
62
|
+
end
|
63
|
+
|
64
|
+
def job_invocation_cancelled_status
|
65
|
+
icon_text('close',
|
66
|
+
@job_invocation_data[3][1],
|
67
|
+
:kind => 'pficon')
|
68
|
+
end
|
69
|
+
|
70
|
+
def task_failed?(task)
|
71
|
+
%w(warning error).include? task.result
|
72
|
+
end
|
73
|
+
|
74
|
+
def task_cancelled?(task)
|
75
|
+
task.execution_plan.errors.map(&:exception).any? { |exception| exception.class == ::ForemanTasks::Task::TaskCancelledException }
|
76
|
+
end
|
77
|
+
end
|