foreman_remote_execution 13.2.0 → 13.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/app/lib/actions/remote_execution/run_host_job.rb +2 -1
- data/app/lib/actions/remote_execution/run_hosts_job.rb +1 -0
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +1 -0
- data/app/models/template_invocation.rb +1 -0
- data/app/views/template_invocations/show.html.erb +2 -2
- data/app/views/templates/script/package_action.erb +18 -10
- data/db/migrate/20240522093412_add_smart_proxy_id_to_template_invocation.rb +7 -0
- data/db/migrate/20240522093413_migrate_smart_proxy_ids_to_template_invocations.rb +16 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/webpack/JobWizard/JobWizard.scss +14 -5
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +10 -4
- data/webpack/JobWizard/steps/HostsAndInputs/index.js +4 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96681556d3f5a6992e71260803846de43b28006b4c6632dc8def7772ae8c42b5
|
4
|
+
data.tar.gz: 13fffbea7ed8fa8a9556db7ce1c251ab4a879de339f85a5fb4e0f83977a12bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2f596ae2c2dd3ed2483ee32f78104b26fe39e6e4faa60ba50dfefac947346bd639bad3714a5c89e9df47f0a81389ca59c7c05c7915432985bf1ab03ec53e71a
|
7
|
+
data.tar.gz: c81d5218ffceb943120ed6c141bad17d7ed87e8feaff517b984fde44684ffffe72598f2adc7f350e187139f8e68c521d8c296a53ec9a88baf2f2987176b2d857
|
data/.gitignore
CHANGED
@@ -49,7 +49,8 @@ module Actions
|
|
49
49
|
provider_type = provider.proxy_feature
|
50
50
|
proxy = determine_proxy!(proxy_selector, provider_type, host)
|
51
51
|
link!(proxy)
|
52
|
-
|
52
|
+
template_invocation.smart_proxy_id = proxy.id
|
53
|
+
template_invocation.save!
|
53
54
|
|
54
55
|
renderer = InputTemplateRenderer.new(template_invocation.template, host, template_invocation)
|
55
56
|
script = renderer.render
|
@@ -18,6 +18,7 @@ class TemplateInvocation < ApplicationRecord
|
|
18
18
|
belongs_to :run_host_job_task, :class_name => 'ForemanTasks::Task'
|
19
19
|
has_many :remote_execution_features, :through => :template
|
20
20
|
has_many :template_invocation_events, :dependent => :destroy
|
21
|
+
belongs_to :smart_proxy, :class_name => '::SmartProxy', :inverse_of => :template_invocations
|
21
22
|
|
22
23
|
validates_associated :input_values
|
23
24
|
validate :provides_required_input_values
|
@@ -28,10 +28,10 @@ end
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<% if @host %>
|
31
|
-
<%
|
31
|
+
<% proxy = @template_invocation.smart_proxy %>
|
32
32
|
<h3>
|
33
33
|
<%= _('Target: ') %><%= link_to(@host, current_host_details_path(@host)) %>
|
34
|
-
<% if
|
34
|
+
<% if proxy %>
|
35
35
|
<%= _('using Smart Proxy') %> <%= link_to(proxy.name, smart_proxy_path(proxy)) %>
|
36
36
|
<% end %>
|
37
37
|
</h3>
|
@@ -118,19 +118,27 @@ handle_zypp_res_codes () {
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
-%>
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
run_cmd()
|
122
|
+
{
|
123
|
+
LANG=C apt-get -o APT::Get::Upgrade-Allow-New="true" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y <%= input("options") %> <%= action %> <%= input("package") %> 2>&1
|
124
|
+
}
|
124
125
|
export DEBIAN_FRONTEND=noninteractive
|
125
126
|
apt-get -y update
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
if [ "<%= action %>" = "remove" ]; then
|
128
|
+
OUTFILE=$(mktemp)
|
129
|
+
trap "rm -f $OUTFILE" EXIT
|
130
|
+
run_cmd > $OUTFILE
|
131
|
+
RETVAL=$?
|
132
|
+
cat $OUTFILE
|
133
|
+
if grep -q "Unable to locate" $OUTFILE; then
|
134
|
+
RETVAL=0
|
135
|
+
fi
|
130
136
|
else
|
131
|
-
|
132
|
-
|
137
|
+
run_cmd
|
138
|
+
RETVAL=$?
|
133
139
|
fi
|
140
|
+
setReturnValue() { RETVAL=$1; return $RETVAL; }
|
141
|
+
setReturnValue $RETVAL
|
134
142
|
<% elsif package_manager == 'zypper' -%>
|
135
143
|
<%-
|
136
144
|
if action == "group install"
|
@@ -141,7 +149,7 @@ handle_zypp_res_codes () {
|
|
141
149
|
-%>
|
142
150
|
zypper refresh
|
143
151
|
zypper -n <%= action %> <%= input("options") %> <%= input("package") %>
|
144
|
-
handle_zypp_res_codes $?
|
152
|
+
handle_zypp_res_codes $? "<%= action %>"
|
145
153
|
<% end -%>
|
146
154
|
RETVAL=$?
|
147
155
|
[ $RETVAL -eq 0 ] || exit_with_message "Package action failed" $RETVAL
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class MigrateSmartProxyIdsToTemplateInvocations < ActiveRecord::Migration[6.0]
|
2
|
+
def up
|
3
|
+
ForemanTasks::Link.joins(:task)
|
4
|
+
.where(resource_type: 'SmartProxy', task: { label: 'Actions::RemoteExecution::RunHostJob' })
|
5
|
+
.where.not(resource_id: nil)
|
6
|
+
.find_in_batches do |batch|
|
7
|
+
batch.group_by(&:resource_id).each do |resource_id, links|
|
8
|
+
template_invocation_ids = ForemanTasks::Link.where(resource_type: 'TemplateInvocation', task_id: links.map(&:task_id)).select(:resource_id)
|
9
|
+
TemplateInvocation.where(id: template_invocation_ids).update_all(smart_proxy_id: resource_id)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
end
|
16
|
+
end
|
@@ -16,7 +16,17 @@
|
|
16
16
|
); // So the select box can be shown above the wizard footer and navigation toggle
|
17
17
|
}
|
18
18
|
.pf-c-wizard__main-body {
|
19
|
-
max-width:
|
19
|
+
@media (max-width: 600px) {
|
20
|
+
max-width: 100%;
|
21
|
+
}
|
22
|
+
|
23
|
+
@media (min-width: 601px) and (max-width: 1300px) {
|
24
|
+
max-width: 65vw;
|
25
|
+
}
|
26
|
+
@media (min-width: 1301px) {
|
27
|
+
max-width: 50vw;
|
28
|
+
}
|
29
|
+
|
20
30
|
.advanced-fields-title {
|
21
31
|
margin-bottom: 10px;
|
22
32
|
}
|
@@ -40,6 +50,9 @@
|
|
40
50
|
flex-wrap: nowrap;
|
41
51
|
}
|
42
52
|
}
|
53
|
+
.foreman-search-field {
|
54
|
+
width: 100%;
|
55
|
+
}
|
43
56
|
}
|
44
57
|
input[type='radio'],
|
45
58
|
input[type='checkbox'] {
|
@@ -110,10 +123,6 @@
|
|
110
123
|
min-height: 40px;
|
111
124
|
min-width: 100px;
|
112
125
|
}
|
113
|
-
#host-selection {
|
114
|
-
width: 500px;
|
115
|
-
}
|
116
|
-
|
117
126
|
.pf-c-modal-box {
|
118
127
|
width: auto;
|
119
128
|
}
|
@@ -61,14 +61,20 @@ describe('Hosts', () => {
|
|
61
61
|
await act(async () => {
|
62
62
|
fireEvent.click(screen.getByText('Host groups'));
|
63
63
|
});
|
64
|
-
|
64
|
+
await act(async () => {
|
65
|
+
fireEvent.click(select('host groups'));
|
66
|
+
});
|
65
67
|
await act(async () => {
|
66
68
|
fireEvent.click(screen.getByText('host_group1'));
|
67
69
|
});
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
71
|
+
await act(async () => {
|
72
|
+
fireEvent.click(
|
73
|
+
screen.getByText('Host groups', {
|
74
|
+
selector: '.pf-c-select__toggle-text',
|
75
|
+
})
|
76
|
+
);
|
77
|
+
});
|
72
78
|
await act(async () => {
|
73
79
|
fireEvent.click(screen.getByText('Host collections'));
|
74
80
|
});
|
@@ -49,7 +49,10 @@ const HostsAndInputs = ({
|
|
49
49
|
hostsSearchQuery,
|
50
50
|
setHostsSearchQuery,
|
51
51
|
}) => {
|
52
|
-
const
|
52
|
+
const defaultHostMethod = hostsSearchQuery.length
|
53
|
+
? hostMethods.searchQuery
|
54
|
+
: hostMethods.hosts;
|
55
|
+
const [hostMethod, setHostMethod] = useState(defaultHostMethod);
|
53
56
|
const isLoading = useSelector(selectIsLoadingHosts);
|
54
57
|
const templateInputs = useSelector(selectTemplateInputs);
|
55
58
|
const [hostPreviewOpen, setHostPreviewOpen] = useState(false);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.2.
|
4
|
+
version: 13.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Remote Execution team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -350,6 +350,8 @@ files:
|
|
350
350
|
- db/migrate/20220822155946_add_time_to_pickup_to_job_invocation.rb
|
351
351
|
- db/migrate/20221129170145_redefine_template_invocation_events_index.rb
|
352
352
|
- db/migrate/20230816154510_drop_time_span_from_job_invocations.rb
|
353
|
+
- db/migrate/20240522093412_add_smart_proxy_id_to_template_invocation.rb
|
354
|
+
- db/migrate/20240522093413_migrate_smart_proxy_ids_to_template_invocations.rb
|
353
355
|
- db/seeds.d/100-assign_features_with_templates.rb
|
354
356
|
- db/seeds.d/20-permissions.rb
|
355
357
|
- db/seeds.d/50-notification_blueprints.rb
|