foreman_ansible 2.3.6 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ui_ansible_roles_controller.rb +14 -0
- data/app/helpers/foreman_ansible/ansible_roles_helper.rb +4 -0
- data/app/models/ansible_role.rb +1 -0
- data/app/models/foreman_ansible/ansible_provider.rb +6 -1
- data/app/models/setting/ansible.rb +10 -10
- data/app/services/foreman_ansible/inventory_creator.rb +26 -23
- data/app/views/foreman_ansible/ansible_roles/_select_tab_content.html.erb +13 -13
- data/app/views/ui_ansible_roles/index.json.rabl +3 -0
- data/app/views/ui_ansible_roles/main.json.rabl +3 -0
- data/app/views/ui_ansible_roles/show.json.rabl +3 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20190328114657_remove_top_level_ansible_variables_setting.rb +6 -0
- data/lib/foreman_ansible/register.rb +3 -2
- data/lib/foreman_ansible/version.rb +1 -1
- data/locale/de/foreman_ansible.edit.po +90 -191
- data/locale/en/foreman_ansible.edit.po +90 -191
- data/locale/es/foreman_ansible.edit.po +90 -191
- data/locale/fr/foreman_ansible.edit.po +90 -191
- data/locale/it/foreman_ansible.edit.po +90 -191
- data/locale/ja/foreman_ansible.edit.po +90 -191
- data/locale/ko/foreman_ansible.edit.po +90 -191
- data/locale/pt_BR/foreman_ansible.edit.po +90 -191
- data/locale/ru/foreman_ansible.edit.po +90 -191
- data/locale/zh_CN/foreman_ansible.edit.po +90 -191
- data/locale/zh_TW/foreman_ansible.edit.po +90 -191
- data/package.json +50 -9
- data/test/factories/ansible_variables.rb +1 -0
- data/test/functional/ui_ansible_roles_controller_test.rb +14 -0
- data/test/unit/lib/foreman_ansible_core/playbook_runner_test.rb +11 -11
- data/test/unit/services/inventory_creator_test.rb +75 -24
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +5 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js +140 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss +45 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherActions.js +69 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherConstants.js +7 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherHelpers.js +7 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherReducer.js +69 -0
- data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherSelectors.js +68 -0
- data/webpack/components/AnsibleRolesSwitcher/__fixtures__/ansibleRolesData.fixtures.js +20 -0
- data/webpack/components/AnsibleRolesSwitcher/__fixtures__/ansibleRolesSwitcherReducer.fixtures.js +36 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcher.test.js +30 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js +73 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherSelectors.test.js +43 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcher.test.js.snap +79 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcherReducer.test.js.snap +399 -0
- data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcherSelectors.test.js.snap +60 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsiblePermissionDenied.js +33 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsiblePermissionDenied.test.js +9 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +56 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.test.js +26 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleActionButton.js +16 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRolesSwitcherError.js +32 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.js +67 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.test.js +19 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js +52 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.test.js +22 -0
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsiblePermissionDenied.test.js.snap +26 -0
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +108 -0
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AssignedRolesList.test.js.snap +64 -0
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap +54 -0
- data/webpack/components/AnsibleRolesSwitcher/components/withProtectedView.js +14 -0
- data/webpack/components/AnsibleRolesSwitcher/index.js +44 -0
- data/webpack/components/ReportJsonViewer.js +11 -7
- data/webpack/index.js +14 -1
- data/webpack/reducer.js +7 -0
- data/webpack/test_setup.js +11 -0
- metadata +44 -2
@@ -0,0 +1,399 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`AnsibleRolesSwitcherReducer should add Ansible role to assigned 1`] = `
|
4
|
+
Object {
|
5
|
+
"assignedPagination": Object {
|
6
|
+
"page": 1,
|
7
|
+
"perPage": 20,
|
8
|
+
},
|
9
|
+
"assignedRoles": Array [
|
10
|
+
Object {
|
11
|
+
"id": 4,
|
12
|
+
"inherited": true,
|
13
|
+
"name": "geerlingguy.java",
|
14
|
+
},
|
15
|
+
Object {
|
16
|
+
"id": 5,
|
17
|
+
"name": "naftulikay.golang",
|
18
|
+
},
|
19
|
+
Object {
|
20
|
+
"id": 6,
|
21
|
+
"name": "theforeman.foreman_scap_client",
|
22
|
+
},
|
23
|
+
Object {
|
24
|
+
"id": 9,
|
25
|
+
"name": "chef.chef",
|
26
|
+
},
|
27
|
+
],
|
28
|
+
"error": Object {
|
29
|
+
"errorMsg": "",
|
30
|
+
"status": "",
|
31
|
+
"statusText": "",
|
32
|
+
},
|
33
|
+
"itemCount": 10,
|
34
|
+
"loading": false,
|
35
|
+
"pagination": Object {
|
36
|
+
"page": 1,
|
37
|
+
"perPage": 5,
|
38
|
+
},
|
39
|
+
"results": Array [
|
40
|
+
Object {
|
41
|
+
"id": 1,
|
42
|
+
"name": "sthirugn.motd",
|
43
|
+
},
|
44
|
+
Object {
|
45
|
+
"id": 2,
|
46
|
+
"name": "jtyr.ntp",
|
47
|
+
},
|
48
|
+
Object {
|
49
|
+
"id": 3,
|
50
|
+
"name": "rvm.ruby",
|
51
|
+
},
|
52
|
+
Object {
|
53
|
+
"id": 4,
|
54
|
+
"name": "geerlingguy.java",
|
55
|
+
},
|
56
|
+
Object {
|
57
|
+
"id": 5,
|
58
|
+
"name": "naftulikay.golang",
|
59
|
+
},
|
60
|
+
Object {
|
61
|
+
"id": 6,
|
62
|
+
"name": "theforeman.foreman_scap_client",
|
63
|
+
},
|
64
|
+
Object {
|
65
|
+
"id": 7,
|
66
|
+
"name": "ansible.ansible",
|
67
|
+
},
|
68
|
+
Object {
|
69
|
+
"id": 8,
|
70
|
+
"name": "puppet.puppet",
|
71
|
+
},
|
72
|
+
Object {
|
73
|
+
"id": 9,
|
74
|
+
"name": "chef.chef",
|
75
|
+
},
|
76
|
+
Object {
|
77
|
+
"id": 10,
|
78
|
+
"name": "salt.salt",
|
79
|
+
},
|
80
|
+
Object {
|
81
|
+
"id": 11,
|
82
|
+
"name": "anonymous.something",
|
83
|
+
},
|
84
|
+
],
|
85
|
+
}
|
86
|
+
`;
|
87
|
+
|
88
|
+
exports[`AnsibleRolesSwitcherReducer should change pagination for assigned roles 1`] = `
|
89
|
+
Object {
|
90
|
+
"assignedPagination": Object {
|
91
|
+
"page": 20,
|
92
|
+
"perPage": 5,
|
93
|
+
},
|
94
|
+
"assignedRoles": Array [
|
95
|
+
Object {
|
96
|
+
"id": 4,
|
97
|
+
"inherited": true,
|
98
|
+
"name": "geerlingguy.java",
|
99
|
+
},
|
100
|
+
Object {
|
101
|
+
"id": 5,
|
102
|
+
"name": "naftulikay.golang",
|
103
|
+
},
|
104
|
+
Object {
|
105
|
+
"id": 6,
|
106
|
+
"name": "theforeman.foreman_scap_client",
|
107
|
+
},
|
108
|
+
],
|
109
|
+
"error": Object {
|
110
|
+
"errorMsg": "",
|
111
|
+
"status": "",
|
112
|
+
"statusText": "",
|
113
|
+
},
|
114
|
+
"itemCount": 11,
|
115
|
+
"loading": false,
|
116
|
+
"pagination": Object {
|
117
|
+
"page": 1,
|
118
|
+
"perPage": 5,
|
119
|
+
},
|
120
|
+
"results": Array [
|
121
|
+
Object {
|
122
|
+
"id": 1,
|
123
|
+
"name": "sthirugn.motd",
|
124
|
+
},
|
125
|
+
Object {
|
126
|
+
"id": 2,
|
127
|
+
"name": "jtyr.ntp",
|
128
|
+
},
|
129
|
+
Object {
|
130
|
+
"id": 3,
|
131
|
+
"name": "rvm.ruby",
|
132
|
+
},
|
133
|
+
Object {
|
134
|
+
"id": 4,
|
135
|
+
"name": "geerlingguy.java",
|
136
|
+
},
|
137
|
+
Object {
|
138
|
+
"id": 5,
|
139
|
+
"name": "naftulikay.golang",
|
140
|
+
},
|
141
|
+
Object {
|
142
|
+
"id": 6,
|
143
|
+
"name": "theforeman.foreman_scap_client",
|
144
|
+
},
|
145
|
+
Object {
|
146
|
+
"id": 7,
|
147
|
+
"name": "ansible.ansible",
|
148
|
+
},
|
149
|
+
Object {
|
150
|
+
"id": 8,
|
151
|
+
"name": "puppet.puppet",
|
152
|
+
},
|
153
|
+
Object {
|
154
|
+
"id": 9,
|
155
|
+
"name": "chef.chef",
|
156
|
+
},
|
157
|
+
Object {
|
158
|
+
"id": 10,
|
159
|
+
"name": "salt.salt",
|
160
|
+
},
|
161
|
+
Object {
|
162
|
+
"id": 11,
|
163
|
+
"name": "anonymous.something",
|
164
|
+
},
|
165
|
+
],
|
166
|
+
}
|
167
|
+
`;
|
168
|
+
|
169
|
+
exports[`AnsibleRolesSwitcherReducer should remove Ansible role from assigned 1`] = `
|
170
|
+
Object {
|
171
|
+
"assignedPagination": Object {
|
172
|
+
"page": 1,
|
173
|
+
"perPage": 20,
|
174
|
+
},
|
175
|
+
"assignedRoles": Array [
|
176
|
+
Object {
|
177
|
+
"id": 4,
|
178
|
+
"inherited": true,
|
179
|
+
"name": "geerlingguy.java",
|
180
|
+
},
|
181
|
+
Object {
|
182
|
+
"id": 5,
|
183
|
+
"name": "naftulikay.golang",
|
184
|
+
},
|
185
|
+
],
|
186
|
+
"error": Object {
|
187
|
+
"errorMsg": "",
|
188
|
+
"status": "",
|
189
|
+
"statusText": "",
|
190
|
+
},
|
191
|
+
"itemCount": 12,
|
192
|
+
"loading": false,
|
193
|
+
"pagination": Object {
|
194
|
+
"page": 1,
|
195
|
+
"perPage": 5,
|
196
|
+
},
|
197
|
+
"results": Array [
|
198
|
+
Object {
|
199
|
+
"id": 1,
|
200
|
+
"name": "sthirugn.motd",
|
201
|
+
},
|
202
|
+
Object {
|
203
|
+
"id": 2,
|
204
|
+
"name": "jtyr.ntp",
|
205
|
+
},
|
206
|
+
Object {
|
207
|
+
"id": 3,
|
208
|
+
"name": "rvm.ruby",
|
209
|
+
},
|
210
|
+
Object {
|
211
|
+
"id": 4,
|
212
|
+
"name": "geerlingguy.java",
|
213
|
+
},
|
214
|
+
Object {
|
215
|
+
"id": 5,
|
216
|
+
"name": "naftulikay.golang",
|
217
|
+
},
|
218
|
+
Object {
|
219
|
+
"id": 6,
|
220
|
+
"name": "theforeman.foreman_scap_client",
|
221
|
+
},
|
222
|
+
Object {
|
223
|
+
"id": 7,
|
224
|
+
"name": "ansible.ansible",
|
225
|
+
},
|
226
|
+
Object {
|
227
|
+
"id": 8,
|
228
|
+
"name": "puppet.puppet",
|
229
|
+
},
|
230
|
+
Object {
|
231
|
+
"id": 9,
|
232
|
+
"name": "chef.chef",
|
233
|
+
},
|
234
|
+
Object {
|
235
|
+
"id": 10,
|
236
|
+
"name": "salt.salt",
|
237
|
+
},
|
238
|
+
Object {
|
239
|
+
"id": 11,
|
240
|
+
"name": "anonymous.something",
|
241
|
+
},
|
242
|
+
Object {
|
243
|
+
"id": 6,
|
244
|
+
"name": "theforeman.foreman_scap_client",
|
245
|
+
},
|
246
|
+
],
|
247
|
+
}
|
248
|
+
`;
|
249
|
+
|
250
|
+
exports[`AnsibleRolesSwitcherReducer should return initial state 1`] = `
|
251
|
+
Object {
|
252
|
+
"assignedPagination": Object {
|
253
|
+
"page": 1,
|
254
|
+
"perPage": 10,
|
255
|
+
},
|
256
|
+
"assignedRoles": Array [],
|
257
|
+
"error": Object {
|
258
|
+
"errorMsg": "",
|
259
|
+
"status": "",
|
260
|
+
"statusText": "",
|
261
|
+
},
|
262
|
+
"inheritedRoleIds": Array [],
|
263
|
+
"itemCount": 0,
|
264
|
+
"loading": false,
|
265
|
+
"pagination": Object {
|
266
|
+
"page": 1,
|
267
|
+
"perPage": 10,
|
268
|
+
},
|
269
|
+
"results": Array [],
|
270
|
+
}
|
271
|
+
`;
|
272
|
+
|
273
|
+
exports[`AnsibleRolesSwitcherReducer should start loading on Ansible roles request 1`] = `
|
274
|
+
Object {
|
275
|
+
"assignedPagination": Object {
|
276
|
+
"page": 1,
|
277
|
+
"perPage": 10,
|
278
|
+
},
|
279
|
+
"assignedRoles": Array [],
|
280
|
+
"error": Object {
|
281
|
+
"errorMsg": "",
|
282
|
+
"status": "",
|
283
|
+
"statusText": "",
|
284
|
+
},
|
285
|
+
"inheritedRoleIds": Array [],
|
286
|
+
"itemCount": 0,
|
287
|
+
"loading": true,
|
288
|
+
"pagination": Object {
|
289
|
+
"page": 1,
|
290
|
+
"perPage": 10,
|
291
|
+
},
|
292
|
+
"results": Array [],
|
293
|
+
}
|
294
|
+
`;
|
295
|
+
|
296
|
+
exports[`AnsibleRolesSwitcherReducer should stop loading on Ansible roles error 1`] = `
|
297
|
+
Object {
|
298
|
+
"assignedPagination": Object {
|
299
|
+
"page": 1,
|
300
|
+
"perPage": 10,
|
301
|
+
},
|
302
|
+
"assignedRoles": Array [],
|
303
|
+
"error": Object {
|
304
|
+
"errorMsg": "Failed to fetch Ansible Roles from server.",
|
305
|
+
"statusText": "500",
|
306
|
+
},
|
307
|
+
"inheritedRoleIds": Array [],
|
308
|
+
"itemCount": 0,
|
309
|
+
"loading": false,
|
310
|
+
"pagination": Object {
|
311
|
+
"page": 1,
|
312
|
+
"perPage": 10,
|
313
|
+
},
|
314
|
+
"results": Array [],
|
315
|
+
}
|
316
|
+
`;
|
317
|
+
|
318
|
+
exports[`AnsibleRolesSwitcherReducer should stop loading on Ansible roles success 1`] = `
|
319
|
+
Object {
|
320
|
+
"assignedPagination": Object {
|
321
|
+
"page": 1,
|
322
|
+
"perPage": 10,
|
323
|
+
},
|
324
|
+
"assignedRoles": Array [
|
325
|
+
Object {
|
326
|
+
"id": 4,
|
327
|
+
"name": "geerlingguy.java",
|
328
|
+
},
|
329
|
+
Object {
|
330
|
+
"id": 5,
|
331
|
+
"name": "naftulikay.golang",
|
332
|
+
},
|
333
|
+
Object {
|
334
|
+
"id": 6,
|
335
|
+
"name": "theforeman.foreman_scap_client",
|
336
|
+
},
|
337
|
+
],
|
338
|
+
"error": Object {
|
339
|
+
"errorMsg": "",
|
340
|
+
"status": "",
|
341
|
+
"statusText": "",
|
342
|
+
},
|
343
|
+
"inheritedRoleIds": Array [
|
344
|
+
4,
|
345
|
+
],
|
346
|
+
"itemCount": 11,
|
347
|
+
"loading": false,
|
348
|
+
"pagination": Object {
|
349
|
+
"page": 1,
|
350
|
+
"perPage": 5,
|
351
|
+
},
|
352
|
+
"results": Array [
|
353
|
+
Object {
|
354
|
+
"id": 1,
|
355
|
+
"name": "sthirugn.motd",
|
356
|
+
},
|
357
|
+
Object {
|
358
|
+
"id": 2,
|
359
|
+
"name": "jtyr.ntp",
|
360
|
+
},
|
361
|
+
Object {
|
362
|
+
"id": 3,
|
363
|
+
"name": "rvm.ruby",
|
364
|
+
},
|
365
|
+
Object {
|
366
|
+
"id": 4,
|
367
|
+
"name": "geerlingguy.java",
|
368
|
+
},
|
369
|
+
Object {
|
370
|
+
"id": 5,
|
371
|
+
"name": "naftulikay.golang",
|
372
|
+
},
|
373
|
+
Object {
|
374
|
+
"id": 6,
|
375
|
+
"name": "theforeman.foreman_scap_client",
|
376
|
+
},
|
377
|
+
Object {
|
378
|
+
"id": 7,
|
379
|
+
"name": "ansible.ansible",
|
380
|
+
},
|
381
|
+
Object {
|
382
|
+
"id": 8,
|
383
|
+
"name": "puppet.puppet",
|
384
|
+
},
|
385
|
+
Object {
|
386
|
+
"id": 9,
|
387
|
+
"name": "chef.chef",
|
388
|
+
},
|
389
|
+
Object {
|
390
|
+
"id": 10,
|
391
|
+
"name": "salt.salt",
|
392
|
+
},
|
393
|
+
Object {
|
394
|
+
"id": 11,
|
395
|
+
"name": "anonymous.something",
|
396
|
+
},
|
397
|
+
],
|
398
|
+
}
|
399
|
+
`;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`AnsibleRolesSwitcherSelectors should return all roles when no roles assigned 1`] = `
|
4
|
+
Array [
|
5
|
+
Object {
|
6
|
+
"id": 4,
|
7
|
+
"name": "geerlingguy.java",
|
8
|
+
},
|
9
|
+
Object {
|
10
|
+
"id": 2,
|
11
|
+
"name": "jtyr.ntp",
|
12
|
+
},
|
13
|
+
Object {
|
14
|
+
"id": 3,
|
15
|
+
"name": "rvm.ruby",
|
16
|
+
},
|
17
|
+
Object {
|
18
|
+
"id": 1,
|
19
|
+
"name": "sthirugn.motd",
|
20
|
+
},
|
21
|
+
]
|
22
|
+
`;
|
23
|
+
|
24
|
+
exports[`AnsibleRolesSwitcherSelectors should return requested page 1`] = `
|
25
|
+
Array [
|
26
|
+
Object {
|
27
|
+
"id": 5,
|
28
|
+
"name": "naftulikay.golang",
|
29
|
+
},
|
30
|
+
Object {
|
31
|
+
"id": 8,
|
32
|
+
"name": "puppet.puppet",
|
33
|
+
},
|
34
|
+
Object {
|
35
|
+
"id": 3,
|
36
|
+
"name": "rvm.ruby",
|
37
|
+
},
|
38
|
+
Object {
|
39
|
+
"id": 10,
|
40
|
+
"name": "salt.salt",
|
41
|
+
},
|
42
|
+
Object {
|
43
|
+
"id": 1,
|
44
|
+
"name": "sthirugn.motd",
|
45
|
+
},
|
46
|
+
]
|
47
|
+
`;
|
48
|
+
|
49
|
+
exports[`AnsibleRolesSwitcherSelectors should return unassigned roles 1`] = `
|
50
|
+
Array [
|
51
|
+
Object {
|
52
|
+
"id": 3,
|
53
|
+
"name": "rvm.ruby",
|
54
|
+
},
|
55
|
+
Object {
|
56
|
+
"id": 1,
|
57
|
+
"name": "sthirugn.motd",
|
58
|
+
},
|
59
|
+
]
|
60
|
+
`;
|