foreman_puppet 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +619 -0
  3. data/README.md +38 -0
  4. data/Rakefile +31 -0
  5. data/app/assets/stylesheets/foreman_puppet.scss +117 -0
  6. data/app/controllers/concerns/foreman_puppet/api/import_puppetclasses_common_controller.rb +139 -0
  7. data/app/controllers/concerns/foreman_puppet/environments_import.rb +61 -0
  8. data/app/controllers/concerns/foreman_puppet/extensions/api_hostgroups_controller.rb +40 -0
  9. data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +23 -0
  10. data/app/controllers/concerns/foreman_puppet/extensions/api_v2_hosts_controller.rb +48 -0
  11. data/app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb +58 -0
  12. data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +228 -0
  13. data/app/controllers/concerns/foreman_puppet/extensions/operatingsystems_controller.rb +11 -0
  14. data/app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb +75 -0
  15. data/app/controllers/concerns/foreman_puppet/extensions/parameters_hostgroup.rb +70 -0
  16. data/app/controllers/concerns/foreman_puppet/extensions/parameters_template_combination.rb +21 -0
  17. data/app/controllers/concerns/foreman_puppet/parameters/config_group.rb +17 -0
  18. data/app/controllers/concerns/foreman_puppet/parameters/environment.rb +21 -0
  19. data/app/controllers/concerns/foreman_puppet/parameters/puppetclass.rb +24 -0
  20. data/app/controllers/concerns/foreman_puppet/parameters/puppetclass_lookup_key.rb +24 -0
  21. data/app/controllers/foreman_puppet/api/v2/base_controller.rb +26 -0
  22. data/app/controllers/foreman_puppet/api/v2/config_groups_controller.rb +57 -0
  23. data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +91 -0
  24. data/app/controllers/foreman_puppet/api/v2/host_classes_controller.rb +59 -0
  25. data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +46 -0
  26. data/app/controllers/foreman_puppet/api/v2/lookups_common_controller.rb +114 -0
  27. data/app/controllers/foreman_puppet/api/v2/override_values_controller.rb +99 -0
  28. data/app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb +99 -0
  29. data/app/controllers/foreman_puppet/api/v2/smart_class_parameters_controller.rb +76 -0
  30. data/app/controllers/foreman_puppet/config_groups_controller.rb +46 -0
  31. data/app/controllers/foreman_puppet/environments_controller.rb +51 -0
  32. data/app/controllers/foreman_puppet/puppet_smart_proxies_controller.rb +39 -0
  33. data/app/controllers/foreman_puppet/puppetclass_lookup_keys_controller.rb +33 -0
  34. data/app/controllers/foreman_puppet/puppetclasses_controller.rb +113 -0
  35. data/app/controllers/foreman_puppet/react_controller.rb +19 -0
  36. data/app/helpers/concerns/foreman_puppet/template_renderer_scope.rb +14 -0
  37. data/app/helpers/foreman_puppet/environments_helper.rb +17 -0
  38. data/app/helpers/foreman_puppet/hosts_and_hostgroups_helper.rb +96 -0
  39. data/app/helpers/foreman_puppet/hosts_helper.rb +32 -0
  40. data/app/helpers/foreman_puppet/puppet_smart_proxies_helper.rb +8 -0
  41. data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +135 -0
  42. data/app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb +55 -0
  43. data/app/helpers/foreman_puppet/puppetclasses_helper.rb +59 -0
  44. data/app/helpers/foreman_puppet/template_combinations_helper.rb +33 -0
  45. data/app/models/concerns/foreman_puppet/extensions/host.rb +88 -0
  46. data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +40 -0
  47. data/app/models/concerns/foreman_puppet/extensions/nic_managed.rb +11 -0
  48. data/app/models/concerns/foreman_puppet/extensions/operatingsystem.rb +11 -0
  49. data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +64 -0
  50. data/app/models/concerns/foreman_puppet/extensions/report.rb +11 -0
  51. data/app/models/concerns/foreman_puppet/extensions/taxonomy.rb +19 -0
  52. data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +23 -0
  53. data/app/models/concerns/foreman_puppet/extensions/user.rb +22 -0
  54. data/app/models/concerns/foreman_puppet/host_common.rb +90 -0
  55. data/app/models/concerns/foreman_puppet/puppet_lookup_value_extensions.rb +13 -0
  56. data/app/models/foreman_puppet/config_group.rb +45 -0
  57. data/app/models/foreman_puppet/config_group_class.rb +19 -0
  58. data/app/models/foreman_puppet/environment.rb +63 -0
  59. data/app/models/foreman_puppet/environment_class.rb +40 -0
  60. data/app/models/foreman_puppet/host_class.rb +23 -0
  61. data/app/models/foreman_puppet/host_config_group.rb +15 -0
  62. data/app/models/foreman_puppet/host_puppet_facet.rb +130 -0
  63. data/app/models/foreman_puppet/hostgroup_class.rb +23 -0
  64. data/app/models/foreman_puppet/hostgroup_puppet_facet.rb +98 -0
  65. data/app/models/foreman_puppet/puppetclass.rb +132 -0
  66. data/app/models/foreman_puppet/puppetclass_lookup_key.rb +58 -0
  67. data/app/services/foreman_puppet/host_info_providers/config_groups_info.rb +10 -0
  68. data/app/services/foreman_puppet/host_info_providers/puppet_info.rb +92 -0
  69. data/app/services/foreman_puppet/input_type/puppet_parameter_input.rb +35 -0
  70. data/app/services/foreman_puppet/proxy_status/puppet.rb +17 -0
  71. data/app/services/foreman_puppet/puppet_class_importer.rb +355 -0
  72. data/app/views/api/v2/template_combinations/base.json.erb +9 -0
  73. data/app/views/foreman_puppet/api/v2/config_groups/base.json.rabl +3 -0
  74. data/app/views/foreman_puppet/api/v2/config_groups/create.json.rabl +3 -0
  75. data/app/views/foreman_puppet/api/v2/config_groups/index.json.rabl +3 -0
  76. data/app/views/foreman_puppet/api/v2/config_groups/main.json.rabl +8 -0
  77. data/app/views/foreman_puppet/api/v2/config_groups/show.json.rabl +3 -0
  78. data/app/views/foreman_puppet/api/v2/config_groups/update.json.rabl +3 -0
  79. data/app/views/foreman_puppet/api/v2/environments/base.json.rabl +3 -0
  80. data/app/views/foreman_puppet/api/v2/environments/create.json.rabl +3 -0
  81. data/app/views/foreman_puppet/api/v2/environments/index.json.rabl +3 -0
  82. data/app/views/foreman_puppet/api/v2/environments/main.json.rabl +5 -0
  83. data/app/views/foreman_puppet/api/v2/environments/show.json.rabl +15 -0
  84. data/app/views/foreman_puppet/api/v2/environments/update.json.rabl +3 -0
  85. data/app/views/foreman_puppet/api/v2/host_puppet_facets/base.json.rabl +1 -0
  86. data/app/views/foreman_puppet/api/v2/host_puppet_facets/host_single.json.rabl +17 -0
  87. data/app/views/foreman_puppet/api/v2/host_puppet_facets/show.json.rabl +11 -0
  88. data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/base.json.rabl +5 -0
  89. data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_single.json.rabl +16 -0
  90. data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/show.json.rabl +11 -0
  91. data/app/views/foreman_puppet/api/v2/import_puppetclasses/index.json.rabl +3 -0
  92. data/app/views/foreman_puppet/api/v2/import_puppetclasses/show.json.rabl +36 -0
  93. data/app/views/foreman_puppet/api/v2/override_values/create.json.rabl +3 -0
  94. data/app/views/foreman_puppet/api/v2/override_values/index.json.rabl +3 -0
  95. data/app/views/foreman_puppet/api/v2/override_values/show.json.rabl +3 -0
  96. data/app/views/foreman_puppet/api/v2/override_values/update.json.rabl +3 -0
  97. data/app/views/foreman_puppet/api/v2/puppetclasses/base.json.rabl +3 -0
  98. data/app/views/foreman_puppet/api/v2/puppetclasses/create.json.rabl +3 -0
  99. data/app/views/foreman_puppet/api/v2/puppetclasses/index.json.rabl +4 -0
  100. data/app/views/foreman_puppet/api/v2/puppetclasses/list.json.rabl +3 -0
  101. data/app/views/foreman_puppet/api/v2/puppetclasses/main.json.rabl +5 -0
  102. data/app/views/foreman_puppet/api/v2/puppetclasses/show.json.rabl +15 -0
  103. data/app/views/foreman_puppet/api/v2/puppetclasses/update.json.rabl +3 -0
  104. data/app/views/foreman_puppet/api/v2/smart_class_parameters/base.json.rabl +4 -0
  105. data/app/views/foreman_puppet/api/v2/smart_class_parameters/create.json.rabl +3 -0
  106. data/app/views/foreman_puppet/api/v2/smart_class_parameters/destroy.json.rabl +3 -0
  107. data/app/views/foreman_puppet/api/v2/smart_class_parameters/index.json.rabl +3 -0
  108. data/app/views/foreman_puppet/api/v2/smart_class_parameters/main.json.rabl +23 -0
  109. data/app/views/foreman_puppet/api/v2/smart_class_parameters/show.json.rabl +19 -0
  110. data/app/views/foreman_puppet/api/v2/smart_class_parameters/update.json.rabl +3 -0
  111. data/app/views/foreman_puppet/config_groups/_config_group.html.erb +34 -0
  112. data/app/views/foreman_puppet/config_groups/_config_groups_selection.html.erb +36 -0
  113. data/app/views/foreman_puppet/config_groups/_form.html.erb +9 -0
  114. data/app/views/foreman_puppet/config_groups/edit.html.erb +3 -0
  115. data/app/views/foreman_puppet/config_groups/index.html.erb +31 -0
  116. data/app/views/foreman_puppet/config_groups/new.html.erb +3 -0
  117. data/app/views/foreman_puppet/config_groups/welcome.html.erb +12 -0
  118. data/app/views/foreman_puppet/environments/_form.html.erb +20 -0
  119. data/app/views/foreman_puppet/environments/edit.html.erb +8 -0
  120. data/app/views/foreman_puppet/environments/index.html.erb +32 -0
  121. data/app/views/foreman_puppet/environments/new.html.erb +7 -0
  122. data/app/views/foreman_puppet/environments/welcome.html.erb +16 -0
  123. data/app/views/foreman_puppet/layouts/application_react.html.erb +15 -0
  124. data/app/views/foreman_puppet/puppet_smart_proxies/_dashboard.html.erb +9 -0
  125. data/app/views/foreman_puppet/puppet_smart_proxies/_environments.html.erb +30 -0
  126. data/app/views/foreman_puppet/puppetclass_lookup_keys/edit.html.erb +3 -0
  127. data/app/views/foreman_puppet/puppetclass_lookup_keys/index.html.erb +22 -0
  128. data/app/views/foreman_puppet/puppetclass_lookup_keys/welcome.html.erb +9 -0
  129. data/app/views/foreman_puppet/puppetclasses/_class_parameters.html.erb +37 -0
  130. data/app/views/foreman_puppet/puppetclasses/_class_selection.html.erb +70 -0
  131. data/app/views/foreman_puppet/puppetclasses/_classes.html.erb +22 -0
  132. data/app/views/foreman_puppet/puppetclasses/_classes_in_groups.html.erb +5 -0
  133. data/app/views/foreman_puppet/puppetclasses/_classes_parameters.html.erb +16 -0
  134. data/app/views/foreman_puppet/puppetclasses/_form.html.erb +62 -0
  135. data/app/views/foreman_puppet/puppetclasses/_selected_classes.html.erb +4 -0
  136. data/app/views/foreman_puppet/puppetclasses/edit.html.erb +4 -0
  137. data/app/views/foreman_puppet/puppetclasses/index.html.erb +47 -0
  138. data/app/views/hosts/_form_puppet_enc_tab.html.erb +24 -0
  139. data/app/views/hosts/foreman_puppet/_form_main_tab_fields.html.erb +1 -0
  140. data/app/views/hosts/select_multiple_environment.html.erb +8 -0
  141. data/app/views/provisioning_templates/_combination.html.erb +5 -0
  142. data/app/views/provisioning_templates/_combinations.html.erb +6 -0
  143. data/app/views/smart_proxies/plugins/_puppet.html.erb +24 -0
  144. data/config/api_routes.rb +81 -0
  145. data/config/routes.rb +89 -0
  146. data/db/migrate/20101121140000_add_environment_to_template_combinations.foreman_puppet.rb +9 -0
  147. data/db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb +19 -0
  148. data/db/migrate/20200722171017_create_host_puppet_facet.foreman_puppet.rb +10 -0
  149. data/db/migrate/20200803113531_create_hostgroup_puppet_facet.foreman_puppet.rb +10 -0
  150. data/db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb +22 -0
  151. data/db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb +29 -0
  152. data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +47 -0
  153. data/db/migrate_foreman/20090722141107_create_environments.rb +17 -0
  154. data/db/migrate_foreman/20120905095532_create_environment_classes.rb +15 -0
  155. data/db/migrate_foreman/20140407161817_create_config_groups.rb +9 -0
  156. data/db/migrate_foreman/20140407162007_create_config_group_classes.rb +10 -0
  157. data/db/migrate_foreman/20140407162059_create_host_config_groups.rb +11 -0
  158. data/db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.rb +10 -0
  159. data/db/migrate_foreman/20170109115157_fix_lookup_key_auditable_type.rb +15 -0
  160. data/db/migrate_foreman/20180816134832_cast_lookup_key_values.rb +35 -0
  161. data/db/migrate_foreman/20181023112532_add_environment_puppetclass_id.rb +7 -0
  162. data/db/migrate_foreman/20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.rb +6 -0
  163. data/db/seeds.d/111_puppet_proxy_feature.rb +8 -0
  164. data/lib/foreman_puppet.rb +10 -0
  165. data/lib/foreman_puppet/engine.rb +82 -0
  166. data/lib/foreman_puppet/register.rb +218 -0
  167. data/lib/foreman_puppet/version.rb +3 -0
  168. data/lib/tasks/foreman_puppet_tasks.rake +31 -0
  169. data/locale/Makefile +60 -0
  170. data/locale/action_names.rb +5 -0
  171. data/locale/en/foreman_puppet.edit.po +911 -0
  172. data/locale/en/foreman_puppet.po +690 -0
  173. data/locale/en/foreman_puppet.po.time_stamp +0 -0
  174. data/locale/foreman_puppet.pot +1076 -0
  175. data/locale/gemspec.rb +2 -0
  176. data/test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb +28 -0
  177. data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +346 -0
  178. data/test/controllers/foreman_puppet/api/v2/host_classes_controller_test.rb +48 -0
  179. data/test/controllers/foreman_puppet/api/v2/hostgroup_classes_controller_test.rb +41 -0
  180. data/test/controllers/foreman_puppet/api/v2/hostgroups_controller_test.rb +79 -0
  181. data/test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb +101 -0
  182. data/test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb +29 -0
  183. data/test/controllers/foreman_puppet/api/v2/override_values_controller_test.rb +169 -0
  184. data/test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb +144 -0
  185. data/test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb +557 -0
  186. data/test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb +81 -0
  187. data/test/controllers/foreman_puppet/config_groups_controller_test.rb +47 -0
  188. data/test/controllers/foreman_puppet/environments_controller_test.rb +230 -0
  189. data/test/controllers/foreman_puppet/hostgroups_controller_test.rb +72 -0
  190. data/test/controllers/foreman_puppet/hosts_controller_test.rb +346 -0
  191. data/test/controllers/foreman_puppet/puppet_smart_proxies_controller_test.rb +29 -0
  192. data/test/controllers/foreman_puppet/puppetclass_lookup_keys_controller_test.rb +59 -0
  193. data/test/controllers/foreman_puppet/puppetclasses_controller_test.rb +235 -0
  194. data/test/controllers/provisioning_templates_controller_test.rb +70 -0
  195. data/test/factories/foreman_puppet_factories.rb +134 -0
  196. data/test/factories/host_puppet_enhancements.rb +61 -0
  197. data/test/factories/proxy_puppet_enhancements.rb +33 -0
  198. data/test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb +65 -0
  199. data/test/helpers/foreman_puppet/puppetclasses_helper_test.rb +33 -0
  200. data/test/integration/foreman_puppet/environment_js_test.rb +27 -0
  201. data/test/integration/foreman_puppet/host_js_test.rb +371 -0
  202. data/test/integration/foreman_puppet/hostgroup_js_test.rb +100 -0
  203. data/test/integration/foreman_puppet/puppetclass_js_test.rb +37 -0
  204. data/test/integration/foreman_puppet/smartclass_parameter_js_test.rb +84 -0
  205. data/test/models/foreman_puppet/config_group_class_test.rb +9 -0
  206. data/test/models/foreman_puppet/config_group_test.rb +8 -0
  207. data/test/models/foreman_puppet/environment_test.rb +92 -0
  208. data/test/models/foreman_puppet/host_config_group_test.rb +39 -0
  209. data/test/models/foreman_puppet/host_puppet_facet_test.rb +116 -0
  210. data/test/models/foreman_puppet/host_test.rb +288 -0
  211. data/test/models/foreman_puppet/hostgroup_puppet_facet_test.rb +200 -0
  212. data/test/models/foreman_puppet/hostgroup_test.rb +14 -0
  213. data/test/models/foreman_puppet/lookup_value_test.rb +69 -0
  214. data/test/models/foreman_puppet/provisioning_template_test.rb +124 -0
  215. data/test/models/foreman_puppet/puppetclass_lookup_key_test.rb +81 -0
  216. data/test/models/foreman_puppet/puppetclass_test.rb +144 -0
  217. data/test/models/foreman_puppet/smart_proxy_test.rb +28 -0
  218. data/test/qraphql/queries/host_puppet_query_test.rb +36 -0
  219. data/test/qraphql/queries/hostgroup_puppet_query_test.rb +36 -0
  220. data/test/services/foreman_puppet/host_info_providers/puppet_info_test.rb +791 -0
  221. data/test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb +14 -0
  222. data/test/test_puppet_helper.rb +30 -0
  223. data/test/unit/foreman_puppet/access_permissions_test.rb +16 -0
  224. data/test/unit/foreman_puppet/puppet_class_importer_test.rb +247 -0
  225. data/test/unit/foreman_puppet/template_rendering_test.rb +20 -0
  226. data/test/unit/foreman_puppet_test.rb +11 -0
  227. data/webpack/__mocks__/foremanReact/common/I18n.js +7 -0
  228. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +2 -0
  229. data/webpack/__mocks__/foremanReact/readme.md +11 -0
  230. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +10 -0
  231. data/webpack/__mocks__/foremanReact/redux/API/index.js +10 -0
  232. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +8 -0
  233. data/webpack/__mocks__/foremanReact/redux/index.js +1 -0
  234. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -0
  235. data/webpack/fills_index.js +30 -0
  236. data/webpack/index.js +18 -0
  237. data/webpack/src/ForemanPuppet.js +11 -0
  238. data/webpack/src/Router/__snapshots__/routes.test.js.snap +3 -0
  239. data/webpack/src/Router/index.js +14 -0
  240. data/webpack/src/Router/routes.js +3 -0
  241. data/webpack/src/Router/routes.test.js +16 -0
  242. data/webpack/src/foreman_class_edit.js +224 -0
  243. data/webpack/src/foreman_puppet_host_form.js +140 -0
  244. data/webpack/src/foreman_puppet_host_form.test.js +65 -0
  245. data/webpack/src/index.js +1 -0
  246. data/webpack/src/reducers.js +7 -0
  247. metadata +340 -0
@@ -0,0 +1,31 @@
1
+
2
+ <% content_for(:search_bar) { } %>
3
+ <% title _('Config Groups') %>
4
+
5
+ <% title_actions new_link(_('Create Config Group'), engine: foreman_puppet), help_button %>
6
+
7
+ <table class="<%= table_css_classes 'table-fixed' %>">
8
+ <thead>
9
+ <tr>
10
+ <th class="col-md-6"><%= sort :name %></th>
11
+ <th><%= _('Puppet Classes') %></th>
12
+ <th><%= _('Hosts') %></th>
13
+ <th><%= _('Host Groups') %></th>
14
+ <th><%= _('Actions') %></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @config_groups.each do |config_group| %>
19
+ <tr>
20
+ <td class="ellipsis"><%= link_to_if_authorized config_group.name, hash_for_edit_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer) %></td>
21
+ <td><%= link_to config_group.puppetclasses.size, puppetclasses_path(:search => %Q{config_group = "#{config_group}"}) %></td>
22
+ <td><%= link_to config_group.hosts_count, main_app.hosts_path(:search => %Q{config_group = "#{config_group}"}) %></td>
23
+ <td><%= link_to config_group.hostgroups_count, main_app.hostgroups_path(:search => %Q{config_group = "#{config_group}"}) %></td>
24
+ <td><%= action_buttons(
25
+ display_delete_if_authorized(hash_for_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer), :data => { :confirm => _('Delete %s?') % config_group.name }))%>
26
+ </td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ <%= will_paginate_with_info @config_groups %>
@@ -0,0 +1,3 @@
1
+ <% title _("Create Config Group") %>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,12 @@
1
+ <% title _("Config Groups") %>
2
+ <div class="blank-slate-pf">
3
+ <div class="blank-slate-pf-icon">
4
+ <%= icon_text("object-group", "", kind: "fa") %>
5
+ </div>
6
+ <h1><%= _('Config Groups') %></h1>
7
+ <p><%= _("A config group provides a one-step method of associating many Puppet classes to either a host or host group. Typically this would be used to add a particular application profile or stack in one step.") %></p>
8
+ <p><%= link_to _('Learn more about this in the documentation.'), documentation_url("using-config-groups")%></p>
9
+ <div class="blank-slate-pf-main-action">
10
+ <%= new_link(_("Create Config Group"), { engine: foreman_puppet }, { class: 'btn-lg' }) %>
11
+ </div>
12
+ </div>
@@ -0,0 +1,20 @@
1
+ <%= form_for environment do |f| %>
2
+ <%= base_errors_for environment %>
3
+ <ul class="nav nav-tabs" data-tabs="tabs">
4
+ <li class="active"><a href="#primary" data-toggle="tab"><%= _('Environment') %></a></li>
5
+ <% if show_location_tab? %>
6
+ <li><a href="#locations" data-toggle="tab"><%= _('Locations') %></a></li>
7
+ <% end %>
8
+ <% if show_organization_tab? %>
9
+ <li><a href="#organizations" data-toggle="tab"><%= _('Organizations') %></a></li>
10
+ <% end %>
11
+ </ul>
12
+
13
+ <div class="tab-content">
14
+ <div class="tab-pane active" id="primary">
15
+ <%= text_f f, :name %>
16
+ </div>
17
+ <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => environment %>
18
+ </div>
19
+ <%= submit_or_cancel f %>
20
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% title _("Edit %s") % @environment.to_s %>
2
+ <%= breadcrumbs(switchable: true,
3
+ resource_url: environments_path,
4
+ items: [
5
+ { caption: _('Puppet Environments'), url: environments_path },
6
+ { caption: @page_header }
7
+ ]) %>
8
+ <%= render 'form', environment: @environment %>
@@ -0,0 +1,32 @@
1
+ <% title _('Puppet Environments') %>
2
+
3
+ <%= environments_title_actions %>
4
+
5
+ <table class="<%= table_css_classes 'table-fixed' %>">
6
+ <thead>
7
+ <tr>
8
+ <th class="col-md-8"><%= sort :name, :as => s_('Environment|Name') %></th>
9
+ <th><%= _('Hosts') %></th>
10
+ <th><%= _('Actions') %></th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% @environments.each do |environment| %>
15
+ <tr>
16
+ <td class="ellipsis">
17
+ <%= link_to_if_authorized environment.name, hash_for_edit_environment_path(environment).merge(engine: foreman_puppet, auth_object: environment, authorizer: authorizer) %>
18
+ </td>
19
+ <td><%= link_to hosts_count('environment')[environment], main_app.hosts_path(:search => "environment = #{environment}") %></td>
20
+ <td>
21
+ <%= action_buttons(
22
+ link_to(_('Classes'), puppetclasses_path(search: "environment = #{environment}")),
23
+ import_proxy_links(hash_for_import_environments_environments_path(env: environment)),
24
+ display_delete_if_authorized(hash_for_environment_path(environment).merge(engine: foreman_puppet, auth_object: environment, authorizer: authorizer),
25
+ data: { confirm: "Delete #{environment.name}?" })
26
+ ) %>
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
32
+ <%= will_paginate_with_info @environments %>
@@ -0,0 +1,7 @@
1
+ <% title _("Create Environment") %>
2
+ <%= breadcrumbs(switchable: false,
3
+ items: [
4
+ { caption: _('Puppet Environments'), url: environments_path },
5
+ { caption: _('Create Puppet Environment') }
6
+ ]) %>
7
+ <%= render 'form', environment: @environment %>
@@ -0,0 +1,16 @@
1
+ <% content_for(:title, _("Puppet environments")) %>
2
+ <div class="blank-slate-pf">
3
+ <div class="blank-slate-pf-icon">
4
+ <%= icon_text("th", '', kind: "fa") %>
5
+ </div>
6
+ <h1><%= _('Environments') %></h1>
7
+ <p><%= _("If you are planning to use Foreman as an external node classifier you should provide information about one or more environments. This information is commonly imported from a pre-existing Puppet configuration by the use of the %{link_start}Puppet classes and environment importer%{link_end}.").html_safe % { link_start: tag(:a, href: documentation_url("4.2.2Classes"), rel: 'external'), link_end: '</a>'.html_safe } %>
8
+ </p>
9
+ <p><%= link_to(_('Learn more about this in the documentation.'), documentation_url("4.2.1Environments")) %></p>
10
+ <div class="blank-slate-pf-main-action">
11
+ <%= new_link(_('Create Puppet Environment'), { engine: foreman_puppet }, { class: "btn-lg" }) %>
12
+ </div>
13
+ <div class="blank-slate-pf-secondary-action">
14
+ <%= import_proxy_select(hash_for_import_environments_environments_path) %>
15
+ </div>
16
+ </div>
@@ -0,0 +1,15 @@
1
+
2
+ <% content_for(:javascripts) do %>
3
+ <%= webpacked_plugins_js_for :'foreman_puppet' %>
4
+ <% end %>
5
+ <% content_for(:stylesheets) do %>
6
+ <%= webpacked_plugins_css_for :'foreman_puppet' %>
7
+ <% end %>
8
+
9
+ <% content_for(:content) do %>
10
+ <%= notifications %>
11
+ <div id="organization-id" data-id="<%= Organization.current.id if Organization.current %>" ></div>
12
+ <div id="user-id" data-id="<%= User.current.id if User.current %>" ></div>
13
+ <%= react_component('ForemanPuppet') %>
14
+ <% end %>
15
+ <%= render file: "layouts/base" %>
@@ -0,0 +1,9 @@
1
+ <div class="col-md-5">
2
+ <%= render partial: 'dashboard/reports_widget' %>
3
+ </div>
4
+ <div class="col-md-4">
5
+ <%= render partial: 'dashboard/distribution_widget' %>
6
+ </div>
7
+ <div class="col-md-3">
8
+ <%= render partial: 'dashboard/status_chart_widget' %>
9
+ </div>
@@ -0,0 +1,30 @@
1
+ <% if environments.present? %>
2
+ <table class="<%= table_css_classes 'table-fixed' %>">
3
+ <thead>
4
+ <th class="col-md-10"><%= _('Environment') %></th>
5
+ <th class="col-md-2"><%= _('Number of classes') %></th>
6
+ </thead>
7
+ <tbody>
8
+ <% environments.each do |name, count| %>
9
+ <tr>
10
+ <td class="ellipsis"><%= name %></td>
11
+ <td><%= link_to count, puppetclasses_path(search: "environment = #{name}") %></td>
12
+ </tr>
13
+ <% end %>
14
+ <tfoot>
15
+ <th><%= _('Total') %></th>
16
+ <th><%= environments.values.reduce(&:+) %></th>
17
+ </tfoot>
18
+ </tbody>
19
+ </table>
20
+ <% else %>
21
+ <div class="blank-slate-pf">
22
+ <div class="blank-slate-pf-icon">
23
+ <%= icon_text('th', '', kind: 'fa') %>
24
+ </div>
25
+ <h3><%= _('No environments found') %></h3>
26
+ <p>
27
+ <%= _('There are no puppet environments set up on this puppet master. Please check the puppet master configuration.') %>
28
+ </p>
29
+ </div>
30
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <% title _("Edit %s") % @puppetclass_lookup_key.key %>
2
+ <% puppetclass_lookup_keys_breadcrumbs %>
3
+ <%= render 'lookup_keys/edit', :lookup_key => @puppetclass_lookup_key %>
@@ -0,0 +1,22 @@
1
+ <% title _("Smart Class Parameters") %>
2
+ <% title_actions documentation_button('4.2.5ParameterizedClasses') %>
3
+ <table class="<%= table_css_classes 'table-fixed' %>">
4
+ <thead>
5
+ <tr>
6
+ <th class="col-md-5"><%= sort :key, as: _("Parameter") %></th>
7
+ <th class="col-md-5"><%= sort :puppetclass, as: _("Puppet Class") %></th>
8
+ <th><%= _('Number of Overrides') %></th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @lookup_keys.each do |lookup_key| %>
13
+ <tr>
14
+ <td class="ellipsis"><%= link_to_if_authorized lookup_key.key, foreman_puppet.hash_for_edit_puppetclass_lookup_key_path(id: lookup_key).merge(auth_object: lookup_key, permission: 'edit_external_parameters', authorizer: authorizer, engine: foreman_puppet) %></td>
15
+ <% puppet_class = @lookup_keys_to_class[lookup_key.id] %>
16
+ <td class="ellipsis"><%= link_to_if_authorized puppet_class, foreman_puppet.hash_for_edit_puppetclass_path(id: puppet_class).merge(auth_object: puppet_class, authorizer: @puppetclass_authorizer, engine: foreman_puppet) if puppet_class %></td>
17
+ <td><%= lookup_key.lookup_values.size %></td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
22
+ <%= will_paginate_with_info @lookup_keys %>
@@ -0,0 +1,9 @@
1
+ <% title _("Smart Class Parameters") %>
2
+ <div class="blank-slate-pf">
3
+ <div class="blank-slate-pf-icon">
4
+ <%= icon_text("info-circle", "", :kind => "fa") %>
5
+ </div>
6
+ <h1><%= _('Smart Class Parameters') %></h1>
7
+ <p><%= _("Parameterized class support permits detecting, importing, and supplying parameters directly to classes which support it, via the ENC and depending on a set of rules (Smart Matchers).") %></p>
8
+ <p><%= link_to _('Learn more about this in the documentation.'), documentation_url("4.2.5ParameterizedClasses")%></p>
9
+ </div>
@@ -0,0 +1,37 @@
1
+ <% lookup_keys = overridable_puppet_lookup_keys(puppetclass, obj) %>
2
+ <% lookup_keys.each_with_index do |lookup_key, index| %>
3
+ <% lookup_value = lookup_value(obj, lookup_key) %>
4
+ <%
5
+ # LookupValue#match is generated automatically by Host#lookup_values_attributes=
6
+ # from the name, so don't present errors directly to the user. Any validation
7
+ # errors should also be visible against the Host#name field.
8
+ if lookup_value.errors[:match].any?
9
+ logger.debug("Ignoring #{lookup_value.inspect} match errors: #{lookup_value.errors[:match]}")
10
+ lookup_value.errors.delete(:match)
11
+ end
12
+ %>
13
+ <% overridden = lookup_key.overridden?(obj) %>
14
+ <% error = lookup_value.errors %>
15
+ <tr id="puppetclass_<%= puppetclass.id %>_params[<%= lookup_key.id %>]"
16
+ class="fields <%= 'overridden' if overridden %>">
17
+ <%= content_tag(:td, puppetclass.name, :rowspan => lookup_keys.size, :class => "ellipsis") if index == 0 %>
18
+ <td class="ellipsis param_name">
19
+ <%= lookup_key.key %>
20
+ </td>
21
+ <td <%= "class=has-error" if error.present? %>>
22
+ <div class="input-group">
23
+ <%= puppet_lookup_key_with_diagnostic(obj, lookup_key, lookup_value) %>
24
+ <span class="input-group-btn">
25
+ <%= hidden_toggle(lookup_key.hidden_value?, 'font', 'font', true) if lookup_key.hidden_value? %>
26
+ <%= fullscreen_button("$(this).parent().prev()") unless lookup_key.key_type == "boolean" %>
27
+ <%= puppet_override_toggle(overridden) %>
28
+ </span>
29
+ </div>
30
+ <%= content_tag(:span, error.full_messages.to_sentence, :class => "help-block") if error.present? %>
31
+ </td>
32
+ <td class="ca">
33
+ <%= omit_puppet_lookup_check_box(lookup_key, lookup_value, !overridden) %>
34
+ <%= hidden_puppet_lookup_value_fields(lookup_key, lookup_value, !overridden) %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
@@ -0,0 +1,70 @@
1
+ <% if obj.errors[:puppetclasses].any? %>
2
+ <%= alert class: "alert-block alert-danger base in fade has-error",
3
+ text: obj.errors[:puppetclasses].map { |e| "<li>#{e}</li>" }.join.html_safe %>
4
+ <% end %>
5
+
6
+ <div class="row">
7
+ <div class="col-md-4 classes">
8
+ <h3><%= _('Included Classes') %></h3>
9
+
10
+ <ul id="selected_classes">
11
+ <% if authorized_for(controller: :host_editing, action: :edit_classes) %>
12
+ <%= hidden_field_tag "#{resource_type}[puppetclass_ids][]" %>
13
+ <%= render partial: 'foreman_puppet/puppetclasses/selected_classes',
14
+ collection: obj.individual_puppetclasses,
15
+ as: :klass,
16
+ locals: { resource_type: resource_type, obj: obj } %>
17
+ <% unless resource_type == :config_group %>
18
+ <%= render partial: 'foreman_puppet/puppetclasses/classes_in_groups',
19
+ collection: obj.classes_in_groups,
20
+ as: :klass,
21
+ locals: { resource_type: resource_type, obj: obj } %>
22
+ <% end %>
23
+ <% else %>
24
+
25
+ <% obj.puppetclasses.each do |klass| %>
26
+ <li data-original-title="<%= _('Not authorized to edit classes') %>" rel="twipsy" ><%= h klass.name %></li>
27
+ <% end %>
28
+ <% end %>
29
+ </ul>
30
+
31
+ <% if obj.respond_to?(:parent_classes) && obj.parent_classes.size > 0 %>
32
+ <div class="panel-group paneless" id="inherited-classes">
33
+ <div class="panel">
34
+ <div class="panel-heading">
35
+ <h3 class="panel-title">
36
+ <a data-toggle="collapse" data-parent="#inherited-classes" href="#inherited-classes-list" class="collapsed">
37
+ <%= _('Inherited Classes from %s') % obj.parent_name %>
38
+ </a>
39
+ </h3>
40
+ </div>
41
+ <div id="inherited-classes-list" class="panel-collapse collapse">
42
+ <div class="panel-body">
43
+ <%= content_tag(:ul, :id => 'inherited_ids', :'data-inherited-puppetclass-ids' => obj.parent_classes.map(&:id).to_json) do %>
44
+ <% obj.parent_classes.each do |klass| %>
45
+ <li style='color:black;'><%= h klass.name %></li>
46
+ <% end %>
47
+ <% end %>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <% end %>
53
+ </div>
54
+
55
+ <div class="col-md-8 available_classes">
56
+ <h3><%= _('Available Classes') %></h3>
57
+ <div class='clearfix'>
58
+ <div class='form-group col-md-6'>
59
+ <input placeholder="<%= _('Filter classes') %>" class="form-control" onkeyup="tfm.classEditor.filterPuppetClasses(this);" type='text'>
60
+ </div>
61
+ </div>
62
+ <div class="row">
63
+ <%= render 'foreman_puppet/puppetclasses/classes',
64
+ puppetclasses: obj.available_puppetclasses,
65
+ selected_puppet_classes: (obj.classes + obj.puppetclasses).uniq,
66
+ resource_type: resource_type
67
+ %>
68
+ </div>
69
+ </div>
70
+ </div>
@@ -0,0 +1,22 @@
1
+ <% Puppetclass.classes2hash(puppetclasses).sort.in_groups(2,nil) do |group| %>
2
+ <div class="col-md-6 classes">
3
+ <% group.each do |list| %>
4
+ <% next if list.nil? %>
5
+ <ul class="puppetclass_group">
6
+ <li><%= puppetclass_group_with_icon(list, selected_puppet_classes) %>
7
+ <ul id="pc_<%= list.first %>" style="display: none;">
8
+ <% for klass in list.last.sort %>
9
+ <% unless authorized_for(controller: :host_editing, action: :edit_classes) %>
10
+ <li data-original-title="<%= _('Not authorized to edit classes') %>" rel="twipsy"><%= h klass.name %></li>
11
+ <% else %>
12
+ <li id="puppetclass_<%= klass.id %>" class="puppetclass<%= ' hide' if selected_puppet_classes.include?(klass) %>">
13
+ <%= link_to_add_puppetclass(klass, resource_type) %>
14
+ </li>
15
+ <% end %>
16
+ <% end %>
17
+ </ul>
18
+ </li>
19
+ </ul>
20
+ <% end %>
21
+ </div>
22
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <li id="selected_puppetclass_<%= klass.id %>" class="<%= dom_class(klass, 'selected') %>">
2
+ <%= link_to klass.name, "#", rel: "twipsy", data: { 'original-title': _('belongs to config group'),
3
+ id: klass.id, 'class-id': klass.id,
4
+ 'group-class-id': klass.id, 'host-id': obj.id } %>
5
+ </li>
@@ -0,0 +1,16 @@
1
+ <table class="table table-fixed" id="puppet_klasses_parameters_table">
2
+ <thead class="white-header">
3
+ <tr>
4
+ <th class='col-md-3'><%= _('Puppet Class') %></th>
5
+ <th class='col-md-3'><%= _('Name') %></th>
6
+ <th class='col-md-5'><%= _('Value') %></th>
7
+ <th class='col-md-1 ca'><%= _("Omit") %>&nbsp;<%= omit_help %></th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <%= render partial: 'foreman_puppet/puppetclasses/class_parameters',
12
+ collection: puppetclasses_with_parameters_for(obj.puppet),
13
+ as: :puppetclass,
14
+ locals: { obj: obj } %>
15
+ </tbody>
16
+ </table>
@@ -0,0 +1,62 @@
1
+ <%= form_for @puppetclass, url: (@puppetclass.new_record? ? puppetclasses_path : puppetclass_path(id: @puppetclass)) do |f| %>
2
+ <%= base_errors_for @puppetclass %>
3
+ <% unless @puppetclass.errors.empty? %>
4
+ <%= alert class: 'alert-danger', header: '', text: _("The class could not be saved because of an error in one of the class parameters.") %>
5
+ <% end %>
6
+ <ul class="nav nav-tabs" data-tabs="tabs">
7
+ <li class="active"><a href="#primary" data-toggle="tab"><%= _('Puppet Class') %></a></li>
8
+ <li><a href="#smart_class_param" data-toggle="tab"><%= _('Smart Class Parameter') %></a></li>
9
+ </ul>
10
+
11
+ <div class="tab-content">
12
+ <div class="tab-pane active" id="primary">
13
+ <%= text_f f, :name, disabled: true %>
14
+ <%= text_f f, :environments, value: @puppetclass.environments.map(&:name).to_sentence, label: _('Puppet environments'), disabled: true %>
15
+ <%= multiple_checkboxes f, :hostgroups, @puppetclass, Hostgroup, label: _("Host groups") %>
16
+ </div>
17
+ <div class="tab-pane lookup-keys-container" id="smart_class_param">
18
+ <% if @puppetclass.class_params.empty? %>
19
+ <div class="alert alert-success alert-dismissable">
20
+ <%= alert_close %>
21
+ <p><strong>
22
+ <%= _('This Puppet class has no parameters in its signature.') %>
23
+ </strong><br><%= _('To update the class signature, go to the Puppet Classes page and select "Import".') %></p>
24
+ </div>
25
+ <% else %>
26
+ <div class="row">
27
+ <div class='col-md-3'>
28
+ <input placeholder="<%= _('Filter by name') %>" onkeyup="filterByClassParam(this);" type='text' class="form-control">
29
+ </div>
30
+ <div class="form-group col-md-3">
31
+ <div class='input-group'>
32
+ <span class="input-group-addon">@</span>
33
+ <%= select_tag "environment_filter", options_from_collection_for_select(@puppetclass.environments, "id", "name"),
34
+ prompt: _("All environments - (not filtered)"), class: 'form-control', onchange: 'filterByEnvironment(this)' %>
35
+ </div>
36
+ </div>
37
+ <div class='col-md-6 text-right'>
38
+ <%= documentation_button('4.2.5ParameterizedClasses') %>
39
+ </div>
40
+ </div>
41
+ <div class="smart-var-left col-md-3">
42
+ <ul class="nav nav-pills nav-stacked smart-var-tabs" data-tabs="pills">
43
+ <% @puppetclass.class_params.includes(:environments, :environment_classes, :lookup_values).each do |key| %>
44
+ <li data-used-environments=<%= key.environments.map(&:to_s).to_json %> >
45
+ <a data-toggle="tab" id="pill_<%= key.to_param %>" href="#<%= key.to_param %>" title="<%= key.key.size > 43 ? key : "" %>">
46
+ <div class="clip"><%= icon_text((key.override ? "flag": ""), key.to_s.tr('_',' '), kind: 'fa', title: _('Overridden')) %></div>
47
+ </a>
48
+ </li>
49
+ <% end %>
50
+ </ul>
51
+ </div>
52
+ <div class="tab-content col-md-9 stacked-content">
53
+ <%= f.fields_for :class_params do |lookup_keys_form| %>
54
+ <%= render 'lookup_keys/fields', f: lookup_keys_form %>
55
+ <% end %>
56
+ </div>
57
+ <% end %>
58
+ </div>
59
+ </div>
60
+
61
+ <%= submit_or_cancel(f, false, { cancel_path: resource_prev_url_with_search_filters }) %>
62
+ <% end %>