foreman_acd 0.0.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +107 -56
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +124 -0
  4. data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +72 -0
  5. data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +2 -2
  6. data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
  7. data/app/controllers/foreman_acd/app_definitions_controller.rb +46 -9
  8. data/app/controllers/foreman_acd/app_instances_controller.rb +96 -90
  9. data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +23 -0
  10. data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
  11. data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
  12. data/app/controllers/foreman_acd/remote_execution_controller.rb +46 -0
  13. data/app/controllers/ui_acd_controller.rb +20 -4
  14. data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +42 -0
  15. data/app/lib/actions/foreman_acd/run_configurator.rb +41 -0
  16. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
  17. data/app/models/foreman_acd/acd_provider.rb +30 -0
  18. data/app/models/foreman_acd/ansible_playbook.rb +67 -0
  19. data/app/models/foreman_acd/app_definition.rb +25 -1
  20. data/app/models/foreman_acd/app_instance.rb +42 -0
  21. data/app/models/foreman_acd/foreman_host.rb +23 -0
  22. data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
  23. data/app/services/foreman_acd/app_configurator.rb +54 -0
  24. data/app/services/foreman_acd/app_deployer.rb +151 -0
  25. data/app/services/foreman_acd/inventory_creator.rb +54 -0
  26. data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +30 -0
  27. data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +11 -0
  28. data/app/views/foreman_acd/ansible_playbooks/index.html.erb +30 -0
  29. data/app/views/foreman_acd/ansible_playbooks/new.html.erb +3 -0
  30. data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +5 -0
  31. data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +5 -0
  32. data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +9 -0
  33. data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +5 -0
  34. data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +5 -0
  35. data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +9 -0
  36. data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +5 -0
  37. data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +5 -0
  38. data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +5 -0
  39. data/app/views/foreman_acd/app_definitions/_form.html.erb +34 -20
  40. data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
  41. data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
  42. data/app/views/foreman_acd/app_definitions/index.html.erb +10 -6
  43. data/app/views/foreman_acd/app_instances/_form.html.erb +12 -10
  44. data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
  45. data/app/views/foreman_acd/app_instances/index.html.erb +87 -9
  46. data/app/views/foreman_acd/app_instances/report.html.erb +22 -0
  47. data/app/views/templates/job/run_acd_ansible_playbook.erb +62 -0
  48. data/app/views/ui_acd/ansible_data.json.rabl +6 -0
  49. data/app/views/ui_acd/app.json.rabl +6 -2
  50. data/app/views/ui_acd/app_definition.json.rabl +1 -1
  51. data/app/views/ui_acd/{fdata.json.rabl → foreman_data.json.rabl} +1 -1
  52. data/config/routes.rb +35 -1
  53. data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
  54. data/db/migrate/20190625140305_create_app_instances.rb +1 -1
  55. data/db/migrate/20200916091018_create_ansible_playbooks.rb +20 -0
  56. data/db/migrate/20200917120220_add_ansible_playbook_id.rb +14 -0
  57. data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +8 -0
  58. data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +8 -0
  59. data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
  60. data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
  61. data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
  62. data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
  63. data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
  64. data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
  65. data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
  66. data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
  67. data/db/seeds.d/75-job_templates.rb +13 -0
  68. data/lib/foreman_acd/engine.rb +21 -3
  69. data/lib/foreman_acd/plugin.rb +112 -20
  70. data/lib/foreman_acd/version.rb +1 -1
  71. data/locale/en/foreman_acd.edit.po +326 -0
  72. data/locale/en/foreman_acd.po +232 -2
  73. data/locale/en/foreman_acd.po.time_stamp +0 -0
  74. data/locale/foreman_acd.pot +343 -8
  75. data/package.json +1 -1
  76. data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
  77. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +391 -0
  78. data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
  79. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +303 -0
  80. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +15 -0
  81. data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
  82. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +269 -0
  83. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +9 -0
  84. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +49 -0
  85. data/webpack/components/ApplicationDefinition/index.js +35 -0
  86. data/webpack/components/ApplicationInstance/ApplicationInstance.js +451 -0
  87. data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
  88. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +247 -0
  89. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +15 -0
  90. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +309 -0
  91. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +10 -0
  92. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +49 -0
  93. data/webpack/components/ApplicationInstance/components/Service.js +30 -0
  94. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +37 -0
  95. data/webpack/components/ApplicationInstance/index.js +37 -0
  96. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +148 -0
  97. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +44 -0
  98. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +42 -0
  99. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -0
  100. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +38 -0
  101. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
  102. data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
  103. data/webpack/components/ApplicationInstanceReport/index.js +25 -0
  104. data/webpack/components/ParameterSelection/ParameterSelection.js +131 -192
  105. data/webpack/components/ParameterSelection/ParameterSelection.scss +9 -0
  106. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +87 -110
  107. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +15 -19
  108. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -35
  109. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +116 -84
  110. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +3 -7
  111. data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +12 -21
  112. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +1 -1
  113. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +3 -45
  114. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +20 -0
  115. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +22 -46
  116. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
  117. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +40 -265
  118. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +11 -96
  119. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +3 -9
  120. data/webpack/components/ParameterSelection/index.js +6 -8
  121. data/webpack/components/common/AddTableEntry.js +30 -0
  122. data/webpack/components/common/DeleteTableEntry.js +39 -0
  123. data/webpack/components/common/EasyHeaderFormatter.js +18 -0
  124. data/webpack/components/common/EditTableEntry.js +50 -0
  125. data/webpack/components/common/ExtSelect.js +43 -0
  126. data/webpack/components/common/LockTableEntry.js +60 -0
  127. data/webpack/components/common/RailsData.js +27 -0
  128. data/webpack/components/common/__tests__/AddTableEntry.test.js +26 -0
  129. data/webpack/components/common/__tests__/DeleteTableEntry.test.js +29 -0
  130. data/webpack/components/common/__tests__/ExtSelect.test.js +38 -0
  131. data/webpack/components/common/__tests__/RailsData.test.js +16 -0
  132. data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +35 -0
  133. data/webpack/components/common/__tests__/__snapshots__/AddTableEntry.test.js.snap +35 -0
  134. data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +41 -0
  135. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +41 -0
  136. data/webpack/components/common/__tests__/__snapshots__/ExtSelect.test.js.snap +18 -0
  137. data/webpack/components/common/__tests__/__snapshots__/RailsData.test.js.snap +10 -0
  138. data/webpack/helper.js +20 -0
  139. data/webpack/index.js +6 -0
  140. data/webpack/reducer.js +43 -3
  141. metadata +114 -20
File without changes
@@ -1,19 +1,354 @@
1
- # foreman_acd
2
- #
3
- # This file is distributed under the same license as foreman_acd.
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_acd package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
5
  #
5
6
  #, fuzzy
6
7
  msgid ""
7
8
  msgstr ""
8
- "Project-Id-Version: version 0.0.1\n"
9
+ "Project-Id-Version: foreman_acd 1.0.0\n"
9
10
  "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2014-08-20 08:46+0100\n"
11
- "PO-Revision-Date: 2014-08-20 08:46+0100\n"
12
- "Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
13
- "Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
11
+ "POT-Creation-Date: 2021-02-05 21:21+0000\n"
12
+ "PO-Revision-Date: 2021-02-05 21:21+0000\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
15
  "Language: \n"
15
16
  "MIME-Version: 1.0\n"
16
17
  "Content-Type: text/plain; charset=UTF-8\n"
17
18
  "Content-Transfer-Encoding: 8bit\n"
18
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
20
 
21
+ #: ../app/controllers/foreman_acd/ansible_playbooks_controller.rb:22
22
+ msgid ""
23
+ "Successfully created %s. You need to press the \"Import groups\" button\n"
24
+ " before this ansible playbook can be"
25
+ " used in App Definitions!"
26
+ msgstr ""
27
+
28
+ #: ../app/controllers/foreman_acd/ansible_playbooks_controller.rb:116
29
+ msgid "Successfully loaded ansible group variables from %s"
30
+ msgstr ""
31
+
32
+ #: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:15
33
+ msgid "Show ansible playbook"
34
+ msgstr ""
35
+
36
+ #: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:19
37
+ msgid "List ansible playbooks"
38
+ msgstr ""
39
+
40
+ #: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:35
41
+ msgid "Create a ansible playbook"
42
+ msgstr ""
43
+
44
+ #: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:42
45
+ msgid "Deletes ansible playbook"
46
+ msgstr ""
47
+
48
+ #: ../app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb:48
49
+ msgid "Grab ansible playbook"
50
+ msgstr ""
51
+
52
+ #: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:12
53
+ msgid "Show application definition"
54
+ msgstr ""
55
+
56
+ #: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:16
57
+ msgid "List application definitions"
58
+ msgstr ""
59
+
60
+ #: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:32
61
+ msgid "Create a application definition"
62
+ msgstr ""
63
+
64
+ #: ../app/controllers/foreman_acd/api/v2/app_definitions_controller.rb:39
65
+ msgid "Deletes application definition"
66
+ msgstr ""
67
+
68
+ #: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:12
69
+ msgid "Show application instance"
70
+ msgstr ""
71
+
72
+ #: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:18
73
+ msgid "List application instances"
74
+ msgstr ""
75
+
76
+ #: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:39
77
+ msgid "Create a application instance"
78
+ msgstr ""
79
+
80
+ #: ../app/controllers/foreman_acd/api/v2/app_instances_controller.rb:46
81
+ msgid "Deletes application instance"
82
+ msgstr ""
83
+
84
+ #: ../app/models/foreman_acd/ansible_playbook.rb:37
85
+ msgid "Ansible playbook"
86
+ msgstr ""
87
+
88
+ #: ../app/models/foreman_acd/app_definition.rb:37
89
+ msgid "App Definition"
90
+ msgstr ""
91
+
92
+ #: ../app/models/foreman_acd/app_instance.rb:19
93
+ msgid "App Instance"
94
+ msgstr ""
95
+
96
+ #: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:5
97
+ msgid "Ansible playbooks"
98
+ msgstr ""
99
+
100
+ #: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:7
101
+ #: ../app/views/foreman_acd/app_definitions/_form.html.erb:34
102
+ msgid "Locations"
103
+ msgstr ""
104
+
105
+ #: ../app/views/foreman_acd/ansible_playbooks/_form.html.erb:10
106
+ #: ../app/views/foreman_acd/app_definitions/_form.html.erb:37
107
+ msgid "Organizations"
108
+ msgstr ""
109
+
110
+ #: ../app/views/foreman_acd/ansible_playbooks/edit.html.erb:4
111
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:1
112
+ msgid "Ansible Playbooks"
113
+ msgstr ""
114
+
115
+ #: ../app/views/foreman_acd/ansible_playbooks/edit.html.erb:10
116
+ msgid "Edit Ansible Playbook %s"
117
+ msgstr ""
118
+
119
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:4
120
+ #: ../app/views/foreman_acd/ansible_playbooks/new.html.erb:1
121
+ msgid "New Ansible Playbook"
122
+ msgstr ""
123
+
124
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:9
125
+ msgid "AnsiblePlaybook|Name"
126
+ msgstr ""
127
+
128
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:10
129
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:11
130
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:9
131
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:97
132
+ msgid "Description"
133
+ msgstr ""
134
+
135
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:19
136
+ msgid "Import groups"
137
+ msgstr ""
138
+
139
+ #: ../app/views/foreman_acd/ansible_playbooks/index.html.erb:21
140
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:21
141
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:27
142
+ msgid "Delete %s?"
143
+ msgstr ""
144
+
145
+ #: ../app/views/foreman_acd/app_definitions/_form.html.erb:32
146
+ #: ../app/views/foreman_acd/app_definitions/import.html.erb:6
147
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:1
148
+ msgid "Application Definitions"
149
+ msgstr ""
150
+
151
+ #: ../app/views/foreman_acd/app_definitions/edit.html.erb:4
152
+ msgid "App Definitions"
153
+ msgstr ""
154
+
155
+ #: ../app/views/foreman_acd/app_definitions/edit.html.erb:11
156
+ msgid "Edit Application Definition %s"
157
+ msgstr ""
158
+
159
+ #: ../app/views/foreman_acd/app_definitions/import.html.erb:1
160
+ msgid "Import Application Definition"
161
+ msgstr ""
162
+
163
+ #: ../app/views/foreman_acd/app_definitions/import.html.erb:13
164
+ msgid "Application Definition file"
165
+ msgstr ""
166
+
167
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:4
168
+ #: ../app/views/foreman_acd/app_definitions/new.html.erb:1
169
+ msgid "New Application Definition"
170
+ msgstr ""
171
+
172
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:5
173
+ msgid "Import"
174
+ msgstr ""
175
+
176
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:10
177
+ msgid "AppDefinition|Name"
178
+ msgstr ""
179
+
180
+ #: ../app/views/foreman_acd/app_definitions/index.html.erb:22
181
+ msgid "Export"
182
+ msgstr ""
183
+
184
+ #: ../app/views/foreman_acd/app_instances/_form.html.erb:32
185
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:1
186
+ msgid "Application Instances"
187
+ msgstr ""
188
+
189
+ #: ../app/views/foreman_acd/app_instances/edit.html.erb:4
190
+ msgid "App Instances"
191
+ msgstr ""
192
+
193
+ #: ../app/views/foreman_acd/app_instances/edit.html.erb:11
194
+ msgid "Edit Application Instance %s"
195
+ msgstr ""
196
+
197
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:3
198
+ #: ../app/views/foreman_acd/app_instances/new.html.erb:1
199
+ msgid "New Application Instance"
200
+ msgstr ""
201
+
202
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:7
203
+ msgid "AppInstance|Name"
204
+ msgstr ""
205
+
206
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:8
207
+ msgid "Application"
208
+ msgstr ""
209
+
210
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:18
211
+ msgid "Deploy"
212
+ msgstr ""
213
+
214
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:20
215
+ msgid "Run Playbook"
216
+ msgstr ""
217
+
218
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:22
219
+ msgid "Run Playbook - customize first"
220
+ msgstr ""
221
+
222
+ #: ../app/views/foreman_acd/app_instances/index.html.erb:24
223
+ msgid "Report"
224
+ msgstr ""
225
+
226
+ #: ../lib/foreman_acd/plugin.rb:9
227
+ msgid "Applications"
228
+ msgstr ""
229
+
230
+ #: ../lib/foreman_acd/plugin.rb:145
231
+ msgid "Run playbook for ACD"
232
+ msgstr ""
233
+
234
+ #: ../lib/foreman_acd/plugin.rb:147
235
+ msgid "Run an Ansible playbook to configure ACD application"
236
+ msgstr ""
237
+
238
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:74
239
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:114
240
+ msgid "edit entry"
241
+ msgstr ""
242
+
243
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:81
244
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:121
245
+ msgid "change parameters"
246
+ msgstr ""
247
+
248
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:88
249
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:128
250
+ msgid "change ansible variables"
251
+ msgstr ""
252
+
253
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:102
254
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:142
255
+ msgid "edit"
256
+ msgstr ""
257
+
258
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:106
259
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:146
260
+ msgid "settings"
261
+ msgstr ""
262
+
263
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:277
264
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:324
265
+ msgid "change ansible variables for 'all'"
266
+ msgstr ""
267
+
268
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:285
269
+ msgid "Foreman Parameter definition for Application Definition"
270
+ msgstr ""
271
+
272
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:303
273
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:330
274
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:350
275
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:377
276
+ msgid "Save"
277
+ msgstr ""
278
+
279
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:304
280
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:331
281
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:351
282
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:378
283
+ msgid "Cancel"
284
+ msgstr ""
285
+
286
+ #: ../webpack/components/ApplicationDefinition/ApplicationDefinition.js:313
287
+ msgid "Ansible variables for Application Definition"
288
+ msgstr ""
289
+
290
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:53
291
+ msgid ""
292
+ "For some hosts the values for some parameters are missing. Check the values fo"
293
+ "r these hosts:\\n"
294
+ msgstr ""
295
+
296
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:71
297
+ msgid "Unachieved service counts:"
298
+ msgstr ""
299
+
300
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:75
301
+ msgid "- service ${s.name} expects at ${s.minCount} least configured hosts\\n"
302
+ msgstr ""
303
+
304
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:79
305
+ msgid "- service ${s.name} expects no more than ${s.axCount} configured hosts\\n"
306
+ msgstr ""
307
+
308
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:332
309
+ msgid "Foreman Parameter specification for Application Instance"
310
+ msgstr ""
311
+
312
+ #: ../webpack/components/ApplicationInstance/ApplicationInstance.js:360
313
+ msgid "Ansible group variables for Application Instance"
314
+ msgstr ""
315
+
316
+ #: ../webpack/components/ApplicationInstance/components/Service.js:12
317
+ msgid "Min/Max"
318
+ msgstr ""
319
+
320
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:63
321
+ msgid "Value"
322
+ msgstr ""
323
+
324
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:65
325
+ msgid "Default value"
326
+ msgstr ""
327
+
328
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:78
329
+ msgid "Name"
330
+ msgstr ""
331
+
332
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:120
333
+ msgid "Type"
334
+ msgstr ""
335
+
336
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:161
337
+ msgid "Actions"
338
+ msgstr ""
339
+
340
+ #: ../webpack/components/ParameterSelection/ParameterSelectionActions.js:188
341
+ msgid "Failed to fetch data from server."
342
+ msgstr ""
343
+
344
+ #: ../webpack/components/common/DeleteTableEntry.js:24
345
+ msgid "Are you sure you wish to delete this item?"
346
+ msgstr ""
347
+
348
+ #: ../webpack/components/common/DeleteTableEntry.js:26
349
+ msgid "Delete entry"
350
+ msgstr ""
351
+
352
+ #: gemspec.rb:2
353
+ msgid "TODO: Description of ForemanAcd."
354
+ msgstr ""
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_acd",
3
- "version": "0.0.6",
3
+ "version": "0.3.0",
4
4
  "description": "foreman application centric deployment",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_plugin_helper'
4
+ require 'nokogiri'
5
+
6
+ module ForemanAcd
7
+ # Ansible Playbooks Controller tests
8
+ class AnsiblePlaybooksControllerTest < ActionController::TestCase
9
+ setup do
10
+ as_admin { FactoryBot.create(:ansible_playbook) }
11
+ @model = ForemanAcd::AnsiblePlaybook.first
12
+ end
13
+
14
+ basic_index_test('ansible_playbook')
15
+ basic_new_test
16
+ basic_edit_test('ansible_playbook')
17
+
18
+ test 'should destroy ansible playbook' do
19
+ assert_difference('AnsiblePlaybook.count', -1) do
20
+ delete :destroy,
21
+ :params => { :id => @model.id },
22
+ :session => set_session_user
23
+ end
24
+ assert_redirected_to ansible_playbooks_url
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,391 @@
1
+ import $ from 'jquery';
2
+ import React, { useState } from 'react'
3
+ import PropTypes from 'prop-types';
4
+ import {
5
+ Icon,
6
+ Button,
7
+ } from 'patternfly-react';
8
+ import * as resolve from 'table-resolver';
9
+ import ForemanModal from 'foremanReact/components/ForemanModal';
10
+ import Select from 'foremanReact/components/common/forms/Select';
11
+ import ParameterSelection from '../ParameterSelection';
12
+ import AddTableEntry from '../common/AddTableEntry';
13
+ import DeleteTableEntry from '../common/DeleteTableEntry';
14
+ import RailsData from '../common/RailsData';
15
+ import EasyHeaderFormatter from '../common/EasyHeaderFormatter';
16
+ import AnsiblePlaybookSelector from './components/AnsiblePlaybookSelector';
17
+ import { translate as __ } from 'foremanReact/common/I18n';
18
+
19
+ import {
20
+ Table,
21
+ FormControl,
22
+ inlineEditFormatterFactory,
23
+ } from 'patternfly-react';
24
+
25
+ import {
26
+ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
27
+ PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
28
+ } from '../ParameterSelection/ParameterSelectionConstants';
29
+
30
+ class ApplicationDefinition extends React.Component {
31
+
32
+ constructor(props) {
33
+ super(props);
34
+ }
35
+
36
+ isEditing({rowData}) {
37
+ return (rowData.backup !== undefined);
38
+ }
39
+
40
+ createAnsibleGroupObject(ansibleGroups, withAll=false) {
41
+ const ansibleGroupObj = {};
42
+
43
+ const ansibleGroupArray = Object.keys(ansibleGroups);
44
+ ansibleGroupArray.forEach(e => (ansibleGroupObj[e] = e));
45
+
46
+ if ((withAll === false) && (ansibleGroupObj.hasOwnProperty('all'))) {
47
+ delete ansibleGroupObj.all;
48
+ }
49
+
50
+ return ansibleGroupObj;
51
+ }
52
+
53
+ addTableEntryAllowed() {
54
+ return this.props.editMode || this.props.ansiblePlaybook.id == ''
55
+ }
56
+
57
+ componentDidMount() {
58
+ const {
59
+ data: { mode, ansiblePlaybook, ansibleDataUrl, services, ansibleVarsAll, hostgroups },
60
+ initApplicationDefinition,
61
+ addApplicationDefinitionService,
62
+ deleteApplicationDefinitionService,
63
+ activateEditApplicationDefinitionService,
64
+ changeEditApplicationDefinitionService,
65
+ openForemanParameterSelectionModal,
66
+ openAnsibleParameterSelectionModal,
67
+ loadAnsibleData,
68
+ } = this.props;
69
+
70
+ const inlineEditButtonsFormatter = inlineEditFormatterFactory({
71
+ isEditing: additionalData => this.props.editMode,
72
+ renderValue: (value, additionalData) => (
73
+ <td style={{ padding: '2px' }}>
74
+ <Button
75
+ bsStyle="default"
76
+ onClick={() => activateEditApplicationDefinitionService(additionalData)}
77
+ >
78
+ <Icon type="pf" name="edit" title={__("edit entry")} />
79
+ </Button>
80
+ &nbsp;
81
+ <Button
82
+ bsStyle="default"
83
+ onClick={() => openForemanParameterSelectionModal(additionalData)}
84
+ >
85
+ <Icon type="pf" name="settings" title={__("change parameters")} />
86
+ </Button>
87
+ &nbsp;
88
+ <Button
89
+ bsStyle="default"
90
+ onClick={() => openAnsibleParameterSelectionModal(additionalData)}
91
+ >
92
+ <span title={__("change ansible variables")}>A</span>
93
+ </Button>
94
+ &nbsp;
95
+ <DeleteTableEntry
96
+ hidden={false}
97
+ disabled={false}
98
+ onDeleteTableEntry={deleteApplicationDefinitionService}
99
+ additionalData={additionalData}
100
+ />
101
+ </td>
102
+ ),
103
+ renderEdit: (value, additionalData) => (
104
+ <td style={{ padding: '2px' }}>
105
+ <Button bsStyle="default" disabled>
106
+ <Icon type="pf" name={__("edit")} />
107
+ </Button>
108
+ &nbsp;
109
+ <Button bsStyle="default" disabled>
110
+ <Icon type="pf" name={__("settings")} />
111
+ </Button>
112
+ &nbsp;
113
+ <Button
114
+ bsStyle="default" disabled>
115
+ <span>A</span>
116
+ </Button>
117
+ &nbsp;
118
+ <DeleteTableEntry
119
+ hidden={false}
120
+ disabled={true}
121
+ onDeleteTableEntry={deleteApplicationDefinitionService}
122
+ additionalData={additionalData}
123
+ />
124
+ </td>
125
+ )
126
+ });
127
+ this.inlineEditButtonsFormatter = inlineEditButtonsFormatter;
128
+
129
+ this.headerFormatter = EasyHeaderFormatter;
130
+
131
+ const inlineEditFormatterImpl = {
132
+ renderValue: (value, additionalData) => (
133
+ <td>
134
+ <span className="static">{value}</span>
135
+ </td>
136
+ ),
137
+ renderEditText: (value, additionalData, subtype='text') => (
138
+ <td className="editing">
139
+ <FormControl
140
+ type={subtype}
141
+ defaultValue={value}
142
+ onBlur={e => changeEditApplicationDefinitionService(e.target.value, additionalData) }
143
+ />
144
+ </td>
145
+ ),
146
+ renderEditSelect: (value, additionalData, options) => (
147
+ <td className="editing">
148
+ <Select
149
+ value={value.toString()}
150
+ onChange={e => changeEditApplicationDefinitionService(e.target.value, additionalData) }
151
+ options={options}
152
+ allowClear
153
+ key="key"
154
+ />
155
+ </td>
156
+ )
157
+ };
158
+
159
+ const inlineEditFormatter = inlineEditFormatterFactory({
160
+ isEditing: additionalData => this.isEditing(additionalData),
161
+ renderValue: (value, additionalData) => {
162
+ let prettyValue = value;
163
+ if (additionalData.property == 'hostgroup') {
164
+ prettyValue = hostgroups[value];
165
+ }
166
+ else if (additionalData.property == 'ansibleGroup') {
167
+ const ag = this.createAnsibleGroupObject(this.props.ansiblePlaybook.groups);
168
+ prettyValue = ag[value];
169
+ }
170
+ return inlineEditFormatterImpl.renderValue(prettyValue, additionalData)
171
+ },
172
+ renderEdit: (value, additionalData) => {
173
+ if (additionalData.property == 'hostgroup') {
174
+ if (additionalData.rowData.newEntry === true) {
175
+ return inlineEditFormatterImpl.renderEditSelect(value, additionalData, hostgroups);
176
+ }
177
+ return inlineEditFormatterImpl.renderValue(hostgroups[value], additionalData)
178
+ }
179
+ else if (additionalData.property == 'ansibleGroup') {
180
+ const ag = this.createAnsibleGroupObject(this.props.ansiblePlaybook.groups);
181
+
182
+ if (additionalData.rowData.newEntry === true) {
183
+ return inlineEditFormatterImpl.renderEditSelect(value, additionalData, ag);
184
+ }
185
+ return inlineEditFormatterImpl.renderValue(ag[value], additionalData);
186
+ }
187
+ return inlineEditFormatterImpl.renderEditText(value, additionalData);
188
+ }
189
+ });
190
+ this.inlineEditFormatter = inlineEditFormatter;
191
+
192
+ initApplicationDefinition(
193
+ ansiblePlaybook,
194
+ services,
195
+ ansibleVarsAll,
196
+ this.headerFormatter,
197
+ this.inlineEditFormatter,
198
+ this.inlineEditButtonsFormatter,
199
+ );
200
+ };
201
+
202
+ render() {
203
+ const {
204
+ data: { organization, location, mode, ansiblePlaybooks, foremanDataUrl, ansibleDataUrl },
205
+ ansiblePlaybook,
206
+ services,
207
+ columns,
208
+ addApplicationDefinitionService,
209
+ confirmEditApplicationDefinitionService,
210
+ cancelEditApplicationDefinitionService,
211
+ closeForemanParameterSelectionModal,
212
+ openAnsibleParameterSelectionModal,
213
+ closeAnsibleParameterSelectionModal,
214
+ changeParameterSelectionMode,
215
+ ParameterSelectionModal,
216
+ loadAnsibleData,
217
+ } = this.props;
218
+
219
+
220
+ return (
221
+ <span>
222
+ <div>
223
+ <AnsiblePlaybookSelector
224
+ label="Ansible Playbook"
225
+ editable={ mode == 'newDefinition' }
226
+ viewText={ ansiblePlaybook.name }
227
+ options={ ansiblePlaybooks }
228
+ onChange={ loadAnsibleData }
229
+ selectValue={ ansiblePlaybook.id.toString() }
230
+ additionalData={{url: ansibleDataUrl }}
231
+ />
232
+ {ansiblePlaybook.id == '' ? (
233
+ <p style={{ paddingTop: 25 }}>
234
+ <pre>{ "Ansible Playbook can't be blank" }</pre>
235
+ </p>
236
+ ) : (<div></div>)}
237
+
238
+ </div>
239
+ <div className="form-group">
240
+ <Table.PfProvider
241
+ striped
242
+ bordered
243
+ hover
244
+ dataTable
245
+ inlineEdit
246
+ columns={columns}
247
+ components={{
248
+ body: {
249
+ row: Table.InlineEditRow,
250
+ cell: cellProps => cellProps.children
251
+ }
252
+ }}
253
+ >
254
+ <Table.Header headerRows={resolve.headerRows({ columns })} />
255
+ <Table.Body
256
+ rows={services}
257
+ rowKey="id"
258
+ onRow={(rowData, { rowIndex }) => ({
259
+ role: 'row',
260
+ isEditing: () => this.isEditing({ rowData }),
261
+ onCancel: () => cancelEditApplicationDefinitionService({ rowData, rowIndex }),
262
+ onConfirm: () => confirmEditApplicationDefinitionService({ rowData, rowIndex }),
263
+ last: rowIndex === services.length - 1
264
+ })}
265
+ />
266
+ </Table.PfProvider>
267
+ <AddTableEntry
268
+ hidden={ false }
269
+ disabled={ this.addTableEntryAllowed() }
270
+ onAddTableEntry={ addApplicationDefinitionService }
271
+ />
272
+ <span style={{ marginLeft: 30 }}>
273
+ Ansible group vars 'all':
274
+ <Button
275
+ style={{ marginLeft: 10 }}
276
+ bsStyle="default"
277
+ disabled={ this.props.editMode }
278
+ onClick={() => openAnsibleParameterSelectionModal({
279
+ isAllGroup: true
280
+ })}
281
+ >
282
+ <span title={__("change ansible variables for 'all'")}>A</span>
283
+ </Button>
284
+ </span>
285
+ </div>
286
+ <div>
287
+ <ForemanModal
288
+ id="AppDefinitionForemanParamSelection"
289
+ dialogClassName="param_selection_modal"
290
+ title={__("Foreman Parameter definition for Application Definition")}
291
+ >
292
+ <ForemanModal.Header closeButton={false}>
293
+ Parameter definition
294
+ </ForemanModal.Header>
295
+ {this.props.parametersData ? (
296
+ <ParameterSelection
297
+ editModeCallback={ (hide) => changeParameterSelectionMode({ mode: hide })}
298
+ paramType={ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN }
299
+ location={ location }
300
+ organization={ organization }
301
+ paramDataUrl= { foremanDataUrl }
302
+ data={ this.props.parametersData }
303
+ />
304
+ ) : (<span>Empty</span>)
305
+ }
306
+ <ForemanModal.Footer>
307
+ <div>
308
+ <Button bsStyle="primary" disabled={this.props.paramEditMode} onClick={() => closeForemanParameterSelectionModal({ mode: 'save' })}>{__("Save")}</Button>
309
+ <Button bsStyle="default" disabled={this.props.paramEditMode} onClick={() => closeForemanParameterSelectionModal({ mode: 'cancel' })}>{__("Cancel")}</Button>
310
+ </div>
311
+ </ForemanModal.Footer>
312
+ </ForemanModal>
313
+ </div>
314
+ <div>
315
+ <ForemanModal
316
+ id="AppDefinitionAnsibleParamSelection"
317
+ dialogClassName="param_selection_modal"
318
+ title={__("Ansible variables for Application Definition")}
319
+ >
320
+ <ForemanModal.Header closeButton={false}>
321
+ Parameter definition
322
+ </ForemanModal.Header>
323
+ {this.props.parametersData ? (
324
+ <ParameterSelection
325
+ editModeCallback={ (hide) => changeParameterSelectionMode({ mode: hide })}
326
+ paramType={ PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE }
327
+ location={ location }
328
+ organization={ organization }
329
+ data={ this.props.parametersData }
330
+ />
331
+ ) : (<span>Empty</span>)
332
+ }
333
+ <ForemanModal.Footer>
334
+ <div>
335
+ <Button bsStyle="primary" disabled={this.props.paramEditMode} onClick={() => closeAnsibleParameterSelectionModal({ mode: 'save' })}>{__("Save")}</Button>
336
+ <Button bsStyle="default" disabled={this.props.paramEditMode} onClick={() => closeAnsibleParameterSelectionModal({ mode: 'cancel' })}>{__("Cancel")}</Button>
337
+ </div>
338
+ </ForemanModal.Footer>
339
+ </ForemanModal>
340
+ </div>
341
+ <RailsData
342
+ key='applications_definition'
343
+ view='app_definition'
344
+ parameter='services'
345
+ value={JSON.stringify(this.props.services)}
346
+ />
347
+ <RailsData
348
+ key='applications_definition'
349
+ view='app_definition'
350
+ parameter='ansible_vars_all'
351
+ value={JSON.stringify(this.props.ansibleVarsAll)}
352
+ />
353
+ </span>
354
+ )};
355
+ }
356
+
357
+ ApplicationDefinition.defaultProps = {
358
+ error: {},
359
+ editMode: false,
360
+ ansiblePlaybook: { "id": '', "name": '' },
361
+ services: [],
362
+ ansibleVarsAll: [],
363
+ parametersData: {},
364
+ columns: [],
365
+ editParamsOfRowId: null,
366
+ paramEditMode: false,
367
+ }
368
+
369
+ ApplicationDefinition.propTypes = {
370
+ initApplicationDefinition: PropTypes.func,
371
+ editMode: PropTypes.bool.isRequired,
372
+ ansiblePlaybook: PropTypes.object,
373
+ services: PropTypes.array,
374
+ ansibleVarsAll: PropTypes.array,
375
+ columns: PropTypes.array,
376
+ addApplicationDefinitionService: PropTypes.func,
377
+ deleteApplicationDefinitionService: PropTypes.func,
378
+ activateEditApplicationDefinitionService: PropTypes.func,
379
+ confirmEditApplicationDefinitionService: PropTypes.func,
380
+ cancelEditApplicationDefinitionService: PropTypes.func,
381
+ changeEditApplicationDefinitionService: PropTypes.func,
382
+ openForemanParameterSelectionModal: PropTypes.func,
383
+ closeForemanParameterSelectionModal: PropTypes.func,
384
+ openAnsibleParameterSelectionModal: PropTypes.func,
385
+ closeAnsibleParameterSelectionModal: PropTypes.func,
386
+ changeParameterSelectionMode: PropTypes.func,
387
+ parametersData: PropTypes.object,
388
+ paramEditMode: PropTypes.bool,
389
+ };
390
+
391
+ export default ApplicationDefinition;