foreman_patch 1.1.6.alpha4 → 1.2.0.alpha1
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/app/controllers/foreman_patch/api/v2/invocations_controller.rb +1 -23
- data/app/controllers/foreman_patch/concerns/hosts_controller_extensions.rb +41 -35
- data/app/lib/actions/foreman_patch/cycle/complete.rb +41 -0
- data/app/lib/actions/foreman_patch/cycle/create.rb +1 -5
- data/app/lib/actions/foreman_patch/cycle/initiate.rb +1 -5
- data/app/lib/actions/foreman_patch/cycle/plan.rb +66 -0
- data/app/lib/actions/foreman_patch/invocation/action.rb +29 -23
- data/app/lib/actions/foreman_patch/invocation/patch.rb +8 -16
- data/app/lib/actions/foreman_patch/invocation/wait_for_host.rb +29 -4
- data/app/lib/actions/foreman_patch/round/patch.rb +1 -5
- data/app/lib/actions/foreman_patch/round/plan.rb +33 -0
- data/app/lib/actions/foreman_patch/window/plan.rb +43 -0
- data/app/lib/actions/foreman_patch/window/publish.rb +1 -5
- data/app/lib/actions/foreman_patch/window/resolve_hosts.rb +1 -5
- data/app/models/foreman_patch/invocation.rb +4 -4
- data/app/models/foreman_patch/round.rb +23 -4
- data/app/models/setting/patching.rb +57 -0
- data/app/services/foreman_patch/ticket/api.rb +1 -2
- data/app/views/foreman_patch/api/v2/invocations/base.json.rabl +1 -1
- data/app/views/foreman_patch/api/v2/invocations/phase.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/invocations/show.json.rabl +2 -2
- data/app/views/foreman_patch/api/v2/rounds/base.json.rabl +1 -1
- data/app/views/foreman_patch/api/v2/rounds/status.json.rabl +8 -2
- data/app/views/foreman_patch/groups/index.html.erb +1 -1
- data/app/views/foreman_patch/layouts/react.html.erb +1 -1
- data/app/views/templates/ensure_services.erb +4 -7
- data/config/api_routes.rb +24 -28
- data/config/routes/mount_engine.rb +3 -0
- data/config/routes/overrides.rb +10 -0
- data/config/routes.rb +29 -40
- data/db/seeds.d/100-assign_features_with_templates.rb +12 -6
- data/lib/foreman_patch/engine.rb +46 -11
- data/lib/foreman_patch/plugin.rb +47 -0
- data/lib/foreman_patch/version.rb +1 -1
- data/lib/foreman_patch.rb +2 -3
- data/locale/en/foreman_patch.po +1 -1
- data/locale/foreman_patch.pot +1 -1
- data/locale/gemspec.rb +1 -1
- data/package.json +9 -20
- data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss.gz +0 -0
- data/public/assets/foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css +1 -0
- data/public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css +1 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch.json +1 -1
- data/public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js.gz +0 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css.gz +0 -0
- data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js +6 -0
- data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map +1 -0
- data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map.gz +0 -0
- data/public/webpack/foreman_patch/{foreman_patch.css → foreman_patch-4a4e1a59d74af09c4b8b.css} +1 -1
- data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js +6 -0
- data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map +1 -0
- data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map.gz +0 -0
- data/public/webpack/foreman_patch/manifest.json +14 -13
- data/public/webpack/foreman_patch/manifest.json.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js +2 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map +1 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz +0 -0
- data/webpack/components/Invocation/Invocation.js +47 -0
- data/webpack/{src/Components → components}/Invocation/InvocationSelectors.js +3 -0
- data/webpack/components/Invocation/index.js +36 -0
- data/webpack/components/Invocations/Invocations.js +16 -48
- data/webpack/components/Invocations/InvocationsPage.js +1 -24
- data/webpack/components/Invocations/InvocationsSelectors.js +1 -1
- data/webpack/components/Invocations/components/{InvocationActions.js → InvocationItem.js} +16 -4
- data/webpack/components/Invocations/index.js +12 -95
- data/webpack/components/RoundProgress/AggregateStatus.js +5 -6
- data/webpack/components/RoundProgress/RoundProgress.js +6 -7
- data/webpack/components/RoundProgress/RoundProgressSelectors.js +2 -3
- data/webpack/components/common/Calendar/Calendar.js +4 -5
- data/webpack/components/common/Terminal/OutputLine.js +26 -0
- data/webpack/components/common/Terminal/Terminal.js +115 -0
- data/webpack/components/common/Terminal/Terminal.scss +47 -0
- data/webpack/index.js +0 -3
- metadata +92 -49
- data/app/controllers/foreman_patch/react_controller.rb +0 -12
- data/app/lib/actions/foreman_patch/invocation/process_logging.rb +0 -44
- data/app/lib/actions/foreman_patch/invocation/proxy_action.rb +0 -52
- data/app/models/foreman_patch/event.rb +0 -13
- data/app/views/foreman_patch/api/v2/invocations/event.json.rabl +0 -3
- data/db/migrate/20230706092400_nullify_group_on_delete.rb +0 -11
- data/db/migrate/20230707102800_create_invocation_events.rb +0 -16
- data/lib/foreman_patch/register.rb +0 -119
- data/public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css +0 -11
- data/public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css +0 -11
- data/public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css +0 -82
- data/public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css.gz +0 -0
- data/public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js +0 -9
- data/public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js.gz +0 -0
- data/public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js +0 -9
- data/public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle.js +0 -34173
- data/public/webpack/foreman_patch/foreman_patch.js +0 -34366
- data/public/webpack/foreman_patch/foreman_patch:global.css +0 -1
- data/public/webpack/foreman_patch/foreman_patch:global.js +0 -32098
- data/public/webpack/foreman_patch/vendor.js +0 -5201
- data/webpack/components/common/Calendar/Calendar.css +0 -76
- data/webpack/components/common/Table/index.js +0 -28
- data/webpack/global_index.js +0 -16
- data/webpack/src/Components/Invocation/Invocation.js +0 -67
- data/webpack/src/Components/Invocation/InvocationLogFooter.js +0 -30
- data/webpack/src/Components/Invocation/InvocationLogToolbar.js +0 -80
- data/webpack/src/Components/Invocation/index.js +0 -62
- data/webpack/src/Components/InvocationStatus.js +0 -50
- data/webpack/src/Components/Loading.js +0 -51
- data/webpack/src/Extends/index.js +0 -15
- data/webpack/src/Router/routes.js +0 -5
- data/webpack/src/reducers.js +0 -7
- /data/public/webpack/foreman_patch/{bundle.css → bundle-e45c4bb530e40506f2da.css} +0 -0
- /data/webpack/{src/Components → components}/Invocation/InvocationActions.js +0 -0
- /data/webpack/{src/Components → components}/Invocation/InvocationConsts.js +0 -0
- /data/webpack/components/Invocations/{Invocations.css → InvocationsPage.scss} +0 -0
- /data/{public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss → webpack/components/common/Calendar/Calendar.scss} +0 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
class Setting::Patching < ::Setting
|
2
|
+
def self.default_settings
|
3
|
+
http_proxy_select = [{
|
4
|
+
name: _('Http Proxies'),
|
5
|
+
class: 'HttpProxy',
|
6
|
+
scope: 'all',
|
7
|
+
value_method: 'name',
|
8
|
+
text_method: 'name_and_url',
|
9
|
+
}]
|
10
|
+
|
11
|
+
time_zone_select = [{
|
12
|
+
name: _('Time Zones'),
|
13
|
+
class: 'ActiveSupport::TimeZone',
|
14
|
+
scope: 'all',
|
15
|
+
value_method: 'name',
|
16
|
+
text_method: 'name',
|
17
|
+
}]
|
18
|
+
|
19
|
+
# set(name, description, default, fullname, value, { options })
|
20
|
+
[
|
21
|
+
self.set('host_max_wait_for_up', N_("Maximum seconds to wait for a host after patching restart."),
|
22
|
+
600, N_("Max wait for host up")),
|
23
|
+
self.set('host_patch_timeout', N_("Maximum seconds for a patching invocation to run before timing out"),
|
24
|
+
nil, N_('Patch Timeout')),
|
25
|
+
self.set('patch_schedule_time_zone', N_('Time zone used to base patch window scheduling off of.'),
|
26
|
+
'UTC', N_('Patch Schedule Time Zone'), nil,
|
27
|
+
collection: proc { time_zone_select }),
|
28
|
+
self.set('ticket_api_host', N_('Host used for change management tickets'),
|
29
|
+
nil, N_('Ticket API host')),
|
30
|
+
self.set('ticket_api_proxy', N_('HTTP Proxy to access ticket API host'),
|
31
|
+
nil, N_('Ticket API HTTP proxy'), nil,
|
32
|
+
collection: proc { http_proxy_select }, include_blank: N_('no proxy')),
|
33
|
+
self.set('ticket_api_user', N_('User with access to ticket API'),
|
34
|
+
nil, N_('Ticket API user')),
|
35
|
+
self.set('ticket_api_password', N_('Password for ticket API user'),
|
36
|
+
nil, N_('Ticket API password'), nil, { encrypted: true }),
|
37
|
+
self.set('ticket_api_path', N_('Ticket API path for REST/CRUD operations'),
|
38
|
+
'/api/now/table/change_request', N_('Ticket API path')),
|
39
|
+
self.set('ticket_web_ui_path', N_('Path for opening a ticket in the web UI'),
|
40
|
+
'/change_request.do?sys_id=:id', N_('Ticket Web UI path')),
|
41
|
+
self.set('ticket_label_field', N_('Name of the field used for the ticket label'),
|
42
|
+
'number', N_('Ticket label field')),
|
43
|
+
self.set('ticket_id_field', N_('Name of the field used for the ticket id'),
|
44
|
+
'sys_id', N_('Ticket ID field')),
|
45
|
+
self.set('skip_broken_patches', N_('Skip broken dependencies during patching'), true, N_('Skip broken patches'))
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.humanized_category
|
50
|
+
N_('Patching')
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.load_defaults
|
54
|
+
BLANK_ATTRS.concat %w(ticket_api_host ticket_api_proxy ticket_api_user ticket_api_password, host_patch_timeout)
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
@@ -57,8 +57,7 @@ module ForemanPatch
|
|
57
57
|
|
58
58
|
@response = JSON.parse(raw)
|
59
59
|
rescue RestClient::ExceptionWithResponse => error
|
60
|
-
|
61
|
-
Rails.logger.error(error)
|
60
|
+
Rails.logger.error(error.response)
|
62
61
|
rescue => error
|
63
62
|
Rails.logger.error(error)
|
64
63
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<%= group.label %>
|
23
23
|
</td>
|
24
24
|
<td class="hidden-xs ellipsis">
|
25
|
-
<%= group.default_window_plan
|
25
|
+
<%= group.default_window_plan&.name %>
|
26
26
|
</td>
|
27
27
|
<td class="hidden-xs">
|
28
28
|
<%= link_to group.hosts.count, main_app.hosts_path(search: %Q[patch_group = "#{group.name}"]) %>
|
@@ -7,20 +7,17 @@ feature: ensure_services
|
|
7
7
|
provider_type: SSH
|
8
8
|
%>
|
9
9
|
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 %>
|
10
|
-
|
11
|
-
|
10
|
+
state=$(systemctl is-system-running)
|
11
|
+
while [ $? -ne 0 ]; do
|
12
12
|
case $state in
|
13
13
|
initializing | starting)
|
14
14
|
sleep 5
|
15
|
+
state=$(systemctl is-system-running)
|
15
16
|
;;
|
16
17
|
maintenance | stopping | offline)
|
17
|
-
echo
|
18
|
+
echo $state
|
18
19
|
exit 1
|
19
20
|
;;
|
20
|
-
running)
|
21
|
-
echo "All services running."
|
22
|
-
exit 0
|
23
|
-
;;
|
24
21
|
*)
|
25
22
|
systemctl list-units --failed
|
26
23
|
exit 1
|
data/config/api_routes.rb
CHANGED
@@ -1,41 +1,37 @@
|
|
1
1
|
ForemanPatch::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
resources :
|
6
|
-
|
7
|
-
|
2
|
+
scope :foreman_patch, path: '/foreman_patch' do
|
3
|
+
namespace :api do
|
4
|
+
scope '(:apiv)', module: :v2, defaults: { apiv: 'v2' }, apiv: /v1|v2/, constraints: ApiConstraints.new(version: 2, default: true) do
|
5
|
+
resources :plans, only: [:index, :show, :create, :update, :destroy] do
|
6
|
+
resources :window_plans, only: [:index, :create]
|
7
|
+
resources :cycles, only: [:index, :create]
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
+
resources :window_plans, only: [:index, :show, :update, :destroy]
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
resources :windows, only: [:show, :update, :destroy] do
|
16
|
-
resources :rounds, only: [:index]
|
17
|
-
member do
|
18
|
-
post :schedule
|
12
|
+
resources :cycles, only: [:index, :create, :show, :update, :destroy] do
|
13
|
+
resources :windows, only: [:index, :create]
|
19
14
|
end
|
20
|
-
end
|
21
15
|
|
22
|
-
|
16
|
+
resources :windows, only: [:show, :update, :destroy] do
|
17
|
+
resources :rounds, only: [:index]
|
18
|
+
member do
|
19
|
+
post :schedule
|
20
|
+
end
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
resources :invocations, only: [:index]
|
23
|
+
resources :groups, only: [:index, :show, :create, :update, :destroy]
|
26
24
|
|
27
|
-
|
28
|
-
|
25
|
+
resources :rounds, only: [:show, :create, :update, :destroy] do
|
26
|
+
resources :invocations, only: [:index]
|
27
|
+
member do
|
28
|
+
get :status
|
29
|
+
end
|
29
30
|
end
|
30
|
-
end
|
31
31
|
|
32
|
-
|
33
|
-
collection do
|
34
|
-
put 'move'
|
35
|
-
put 'cancel'
|
36
|
-
end
|
37
|
-
end
|
32
|
+
resources :invocations, only: [:show]
|
38
33
|
|
34
|
+
end
|
39
35
|
end
|
40
36
|
end
|
41
37
|
end
|
data/config/routes.rb
CHANGED
@@ -1,58 +1,47 @@
|
|
1
1
|
ForemanPatch::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
scope :foreman_patch, path: '/foreman_patch' do
|
3
|
+
resources :groups, only: [:index, :new, :create, :edit, :update, :destroy] do
|
4
|
+
collection do
|
5
|
+
get 'auto_complete_search'
|
6
|
+
end
|
5
7
|
end
|
6
|
-
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
resources :cycles, only: [:index, :show, :destroy] do
|
10
|
+
collection do
|
11
|
+
get 'auto_complete_search'
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
resources :windows, only: [:new, :create]
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
+
resources :windows, only: [:show, :destroy]
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
resources :rounds, only: [:show] do
|
20
|
+
collection do
|
21
|
+
get 'auto_complete_search'
|
22
|
+
end
|
21
23
|
end
|
22
|
-
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
resources :invocations, only: [:show, :destroy] do
|
26
|
+
collection do
|
27
|
+
get 'auto_complete_search'
|
28
|
+
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
resources :plans, only: [:index, :new, :create, :show, :edit, :update, :destroy] do
|
32
|
+
resources :window_plans, only: [:new, :create]
|
33
|
+
member do
|
34
|
+
post :iterate
|
35
|
+
end
|
34
36
|
end
|
35
|
-
end
|
36
37
|
|
37
|
-
|
38
|
+
resources :window_plans, only: [:edit, :update, :destroy]
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
collection do
|
42
|
-
get 'auto_complete_search'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
constraints(id: %r{[^/]+}) do
|
47
|
-
resources :hosts, only: [], controller: '/hosts' do
|
40
|
+
resources :ticket_fields, except: [:show] do
|
41
|
+
resources :lookup_values, only: [:index, :create, :update, :destroy]
|
48
42
|
collection do
|
49
|
-
|
50
|
-
post 'update_multiple_patch_group'
|
43
|
+
get 'auto_complete_search'
|
51
44
|
end
|
52
45
|
end
|
53
46
|
end
|
54
47
|
end
|
55
|
-
|
56
|
-
Foreman::Application.routes.draw do
|
57
|
-
mount ForemanPatch::Engine, at: '/foreman_patch'
|
58
|
-
end
|
@@ -1,10 +1,16 @@
|
|
1
1
|
User.as_anonymous_admin do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
RemoteExecutionFeature.without_auditing do
|
3
|
+
if Rails.env.test? || Foreman.in_rake?
|
4
|
+
ForemanPatch.register_rex_features
|
5
|
+
end
|
6
|
+
|
7
|
+
JobTemplate.without_auditing do
|
8
|
+
module_template = JobTemplate.find_by(name: 'Power Action - SSH Default')
|
9
|
+
if module_template && !Rails.env.test? && Setting[:remote_execution_sync_templates]
|
10
|
+
module_template.sync_feature('power_action')
|
11
|
+
module_template.organizations << Organization.unscoped.all if module_template.organizations.empty?
|
12
|
+
module_template.locations << Location.unscoped.all if module_template.locations.empty?
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
data/lib/foreman_patch/engine.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
module ForemanPatch
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
-
isolate_namespace ForemanPatch
|
4
3
|
engine_name 'foreman_patch'
|
4
|
+
isolate_namespace ForemanPatch
|
5
5
|
|
6
|
-
config.
|
6
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
7
|
+
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
8
|
+
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
9
|
+
|
10
|
+
initializer 'foreman_patch.configure_assets', group: :assets do
|
11
|
+
SETTINGS[:foreman_patch] = { assets: { precompile: ['foreman_patch.css'] } }
|
12
|
+
end
|
7
13
|
|
8
14
|
# Add any db migrations
|
9
15
|
initializer 'foreman_patch.load_app_instance_data' do |app|
|
@@ -12,29 +18,40 @@ module ForemanPatch
|
|
12
18
|
end
|
13
19
|
end
|
14
20
|
|
15
|
-
initializer 'foreman_patch.
|
16
|
-
|
21
|
+
initializer 'foreman_patch.mount_engine', before: :sooner_routes_load do |app|
|
22
|
+
app.routes_reloader.paths << "#{ForemanPatch::Engine.root}/config/routes/mount_engine.rb"
|
23
|
+
app.routes_reloader.paths << "#{ForemanPatch::Engine.root}/config/api_routes.rb"
|
24
|
+
app.routes_reloader.paths.unshift("#{ForemanPatch::Engine.root}/config/routes/overrides.rb")
|
25
|
+
end
|
26
|
+
|
27
|
+
initializer 'foreman_patch.load_default_settings', before: :load_config_initializers do |_app|
|
28
|
+
require_dependency File.expand_path('../../../app/models/setting/patching.rb', __FILE__)
|
29
|
+
end
|
30
|
+
|
31
|
+
initializer 'foreman_patch.require_dynflow', before: 'foreman_tasks.initialize_dynflow' do |_app|
|
32
|
+
::ForemanTasks.dynflow.require!
|
33
|
+
::ForemanTasks.dynflow.config.eager_load_paths << File.join(ForemanPatch::Engine.root, 'app/lib/actions/foreman_patch')
|
34
|
+
end
|
35
|
+
|
36
|
+
initializer 'foreman_patch.register_plugin', :before => :finisher_hook do |_app|
|
37
|
+
require 'foreman_patch/plugin'
|
17
38
|
Apipie.configuration.checksum_path += ['/foreman_patch/api/']
|
18
39
|
end
|
19
40
|
|
20
|
-
initializer 'foreman_patch.
|
21
|
-
|
22
|
-
ForemanTasks.dynflow.config.eager_load_paths << File.join(ForemanPatch::Engine.root, 'app/lib/actions/foreman_patch')
|
23
|
-
ForemanTasks.dynflow.eager_load_actions!
|
41
|
+
initializer 'foreman_patch.helpers' do |_app|
|
42
|
+
ActionView::Base.include ForemanPatch::HostsHelper
|
24
43
|
end
|
25
44
|
|
26
45
|
# Include concerns in this config.to_prepare block
|
27
46
|
config.to_prepare do
|
28
47
|
# Model extensions
|
29
|
-
::Host::Managed.include ForemanPatch::Concerns::HostManagedExtensions
|
48
|
+
::Host::Managed.send(:include, ForemanPatch::Concerns::HostManagedExtensions)
|
30
49
|
|
31
50
|
# Controller extensions
|
32
51
|
::HostsController.include ForemanPatch::Concerns::HostsControllerExtensions
|
33
52
|
|
34
53
|
# Api Controller extensions
|
35
54
|
::Api::V2::HostsController.include ForemanPatch::Concerns::Api::V2::HostsControllerExtensions
|
36
|
-
rescue => e
|
37
|
-
Rails.logger.warn "ForemanPatch: skipping engine hook (#{e})"
|
38
55
|
end
|
39
56
|
|
40
57
|
rake_tasks do
|
@@ -49,4 +66,22 @@ module ForemanPatch
|
|
49
66
|
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
50
67
|
end
|
51
68
|
end
|
69
|
+
|
70
|
+
def self.table_name_prefix
|
71
|
+
'foreman_patch_'
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.use_relative_model_naming
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.register_rex_features
|
79
|
+
RemoteExecutionFeature.register(
|
80
|
+
:power_action,
|
81
|
+
N_('Power Action'),
|
82
|
+
description: N_('Power Action'),
|
83
|
+
provided_inputs: 'action',
|
84
|
+
host_action_button: false
|
85
|
+
)
|
86
|
+
end
|
52
87
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Foreman::Plugin.register :foreman_patch do
|
2
|
+
requires_foreman '>= 2.1'
|
3
|
+
|
4
|
+
apipie_documented_controllers(["#{ForemanPatch::Engine.root}/app/controllers/foreman_patch/api/v2/*.rb"])
|
5
|
+
|
6
|
+
register_facet ForemanPatch::Host::GroupFacet, :group_facet do
|
7
|
+
api_view list: 'foreman_patch/api/v2/group_facet/base_with_root', single: 'foreman_patch/api/v2/group_facet/show'
|
8
|
+
api_docs :group_facet_attributes, ::ForemanPatch::Api::V2::HostGroupsController
|
9
|
+
extend_model ForemanPatch::Concerns::GroupFacetHostExtensions
|
10
|
+
set_dependent_action :destroy
|
11
|
+
end
|
12
|
+
|
13
|
+
# Add permissions
|
14
|
+
security_block :foreman_patch do
|
15
|
+
end
|
16
|
+
|
17
|
+
divider :top_menu, caption: N_('Patching'), parent: :content_menu
|
18
|
+
menu :top_menu, :groups,
|
19
|
+
caption: N_('Groups'),
|
20
|
+
engine: ForemanPatch::Engine,
|
21
|
+
parent: :content_menu
|
22
|
+
|
23
|
+
menu :top_menu, :cycles,
|
24
|
+
caption: N_('Cycles'),
|
25
|
+
engine: ForemanPatch::Engine,
|
26
|
+
parent: :content_menu
|
27
|
+
|
28
|
+
menu :top_menu, :plans,
|
29
|
+
caption: N_('Plans'),
|
30
|
+
engine: ForemanPatch::Engine,
|
31
|
+
parent: :content_menu
|
32
|
+
|
33
|
+
menu :top_menu, :ticket_fields,
|
34
|
+
caption: N_('Ticket Fields'),
|
35
|
+
engine: ForemanPatch::Engine,
|
36
|
+
parent: :content_menu
|
37
|
+
|
38
|
+
parameter_filter ::Host::Managed, :group_facet_attributes => [:group_id]
|
39
|
+
|
40
|
+
describe_host do
|
41
|
+
multiple_actions_provider :patch_host_multiple_actions
|
42
|
+
overview_fields_provider :patch_host_overview_fields
|
43
|
+
end
|
44
|
+
|
45
|
+
RemoteExecutionFeature.register(:power_action, N_("Power Action"), description: N_("Power Action"), provided_inputs: ['action'])
|
46
|
+
RemoteExecutionFeature.register(:ensure_services, N_("Ensure Services"), description: N_("Ensure Services are running"))
|
47
|
+
end
|
data/lib/foreman_patch.rb
CHANGED
data/locale/en/foreman_patch.po
CHANGED
data/locale/foreman_patch.pot
CHANGED
data/locale/gemspec.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# Matches foreman_patch.gemspec
|
2
|
-
_(
|
2
|
+
_('TODO: Description of ForemanPatch.')
|
data/package.json
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "foreman_patch",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "TODO",
|
5
|
-
"main": "index.js",
|
3
|
+
"version": "0.0.1",
|
6
4
|
"license": "GPL-3.0",
|
7
5
|
"scripts": {
|
8
6
|
"lint": "tfm-lint --plugin -d /webpack",
|
@@ -11,9 +9,7 @@
|
|
11
9
|
"test:current": "tfm-test --plugin --watch",
|
12
10
|
"publish-coverage": "tfm-publish-coverage",
|
13
11
|
"stories": "tfm-stories --plugin",
|
14
|
-
"stories:build": "tfm-build-stories --plugin"
|
15
|
-
"stories:deploy": "surge --project .storybook-dist",
|
16
|
-
"create-react-component": "yo react-domain"
|
12
|
+
"stories:build": "tfm-build-stories --plugin"
|
17
13
|
},
|
18
14
|
"repository": {
|
19
15
|
"type": "git",
|
@@ -24,23 +20,16 @@
|
|
24
20
|
},
|
25
21
|
"devDependencies": {
|
26
22
|
"@babel/core": "^7.7.0",
|
27
|
-
"@theforeman/builder": "^
|
28
|
-
"@theforeman/eslint-plugin-foreman": "^
|
29
|
-
"@theforeman/
|
30
|
-
"@theforeman/
|
31
|
-
"@theforeman/
|
32
|
-
"@theforeman/vendor-dev": "^8.15.0",
|
23
|
+
"@theforeman/builder": "^6.0.0",
|
24
|
+
"@theforeman/eslint-plugin-foreman": "^6.0.0",
|
25
|
+
"@theforeman/stories": "^7.0.0",
|
26
|
+
"@theforeman/test": "^8.0.0",
|
27
|
+
"@theforeman/vendor-dev": "^6.0.0",
|
33
28
|
"babel-eslint": "^10.0.3",
|
34
29
|
"eslint": "^6.7.2",
|
35
|
-
"
|
36
|
-
"prettier": "^1.19.1",
|
37
|
-
"stylelint-config-standard": "^18.0.0",
|
38
|
-
"stylelint": "^9.3.0"
|
39
|
-
},
|
40
|
-
"dependencies": {
|
41
|
-
"@patternfly/react-log-viewer": "~4.87.100"
|
30
|
+
"prettier": "^1.19.1"
|
42
31
|
},
|
43
32
|
"peerDependencies": {
|
44
|
-
"@theforeman/vendor": "
|
33
|
+
"@theforeman/vendor": ">= 6.0.0"
|
45
34
|
}
|
46
35
|
}
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
div.event{margin:2px 10px;border:1px solid black;border-color:#d1d1d1;padding:2px 3px}
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
div.event{margin:2px 10px;border:1px solid black;border-color:#d1d1d1;padding:2px 3px}
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
{"files":{"foreman_patch/foreman_patch-
|
1
|
+
{"files":{"foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css":{"logical_path":"foreman_patch/foreman_patch.css","mtime":"2024-11-21T20:30:22+00:00","size":87,"digest":"d6fdcb3359ce0ca3edd9a493467bc366b5f2b52a0d3e2fd2b5d1dec121ef31ff","integrity":"sha256-1v3LM1nODKPt2aSTRnvDZrXytSoNPi/StdHewSHvMf8="},"foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss":{"logical_path":"foreman_patch/cycle_plans.scss","mtime":"2024-11-21T20:30:22+00:00","size":106,"digest":"aa7bb2d36a98d83776b4dd9dd93431ba648b84a37478f93c445eb9bda0f84006","integrity":"sha256-qnuy02qY2Dd2tN2d2TQxumSLhKN0ePk8RF65vaD4QAY="},"foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js":{"logical_path":"foreman_patch/plan_edit_windows.js","mtime":"2024-11-21T20:30:22+00:00","size":144,"digest":"be5de0eef57205a38f90eda24c8f8aed707f5d30e8a5abbc3ce9f198ea55a620","integrity":"sha256-vl3g7vVyBaOPkO2iTI+K7XB/XTDopau8POnxmOpVpiA="},"foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css":{"logical_path":"foreman_patch/foreman_patch.css","mtime":"2024-11-21T20:42:30+00:00","size":87,"digest":"d6fdcb3359ce0ca3edd9a493467bc366b5f2b52a0d3e2fd2b5d1dec121ef31ff","integrity":"sha256-1v3LM1nODKPt2aSTRnvDZrXytSoNPi/StdHewSHvMf8="},"foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss":{"logical_path":"foreman_patch/cycle_plans.scss","mtime":"2024-11-21T20:42:30+00:00","size":106,"digest":"aa7bb2d36a98d83776b4dd9dd93431ba648b84a37478f93c445eb9bda0f84006","integrity":"sha256-qnuy02qY2Dd2tN2d2TQxumSLhKN0ePk8RF65vaD4QAY="},"foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js":{"logical_path":"foreman_patch/plan_edit_windows.js","mtime":"2024-11-21T20:42:30+00:00","size":144,"digest":"be5de0eef57205a38f90eda24c8f8aed707f5d30e8a5abbc3ce9f198ea55a620","integrity":"sha256-vl3g7vVyBaOPkO2iTI+K7XB/XTDopau8POnxmOpVpiA="}},"assets":{"foreman_patch/foreman_patch.css":"foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css","foreman_patch/cycle_plans.scss":"foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss","foreman_patch/plan_edit_windows.js":"foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js"}}
|
@@ -0,0 +1 @@
|
|
1
|
+
function remove_window_plan(n){$("#windowPlan"+n).remove()}function edit_window_plan(n){form=null==n?null:$("#windowPlans #windowPlanHidden"+n)}
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
function remove_window_plan(n){$("#windowPlan"+n).remove()}function edit_window_plan(n){form=null==n?null:$("#windowPlans #windowPlanHidden"+n)}
|
Binary file
|
Binary file
|