foreman_remote_execution 11.0.0 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/remote_execution_features_controller.rb +8 -0
- data/app/views/api/v2/remote_execution_features/available_remote_execution_features.json.rabl +6 -0
- data/app/views/templates/script/convert2rhel_analyze.erb +48 -0
- data/config/routes.rb +2 -0
- data/db/migrate/{2021051713291621250977_add_host_proxy_invocations.rb → 20210517132916_add_host_proxy_invocations.rb} +2 -2
- data/lib/foreman_remote_execution/engine.rb +1 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/webpack/react_app/components/FeaturesDropdown/constant.js +2 -1
- data/webpack/react_app/components/FeaturesDropdown/index.js +11 -5
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '019c69e822a9bf8be86315b9cbdf83901e05e0209c115c82a815e92bf0f912e8'
|
4
|
+
data.tar.gz: 7349a60661ccf18d18874a4332a0267dfc535c29fc3871182898dbd8bcf70091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ebac293e75d109be674cb5f01bf760da29d570fa1bd5de83aee24118fb2fd739b384f2b3f058d0400b9a9579e554d2cc401f5c32cd2c557e7a5d012ae4b4ef
|
7
|
+
data.tar.gz: 15557ecad1b8b5a702fa43c235fa381e3e5a9ce18cf9479beef39c4e93e16caf361590559930f4a23de81ef917b57e7ca2a009125e8bd8aaa63559d9a5c5e4a1
|
@@ -29,6 +29,14 @@ module Api
|
|
29
29
|
process_response @remote_execution_feature.update(remote_execution_feature_params)
|
30
30
|
end
|
31
31
|
|
32
|
+
api :GET, '/api/hosts/:id/available_remote_execution_features', N_('List available remote execution features for a host')
|
33
|
+
param :id, :identifier, :required => true
|
34
|
+
def available_remote_execution_features
|
35
|
+
host = Host.find(params[:id])
|
36
|
+
@remote_execution_features = resource_scope
|
37
|
+
@permissions = {:can_run_job => (authorized_for(controller: :job_invocations, action: :create) && (!host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts))) }
|
38
|
+
end
|
39
|
+
|
32
40
|
private
|
33
41
|
|
34
42
|
def parent_scope
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%#
|
2
|
+
name: Convert2RHEL analyze
|
3
|
+
snippet: false
|
4
|
+
template_inputs:
|
5
|
+
- name: Data telemetry
|
6
|
+
required: false
|
7
|
+
input_type: user
|
8
|
+
options: "yes\r\nno"
|
9
|
+
advanced: false
|
10
|
+
value_type: plain
|
11
|
+
default: 'yes'
|
12
|
+
hidden_value: false
|
13
|
+
model: JobTemplate
|
14
|
+
job_category: Convert 2 RHEL
|
15
|
+
provider_type: script
|
16
|
+
kind: job_template
|
17
|
+
%>
|
18
|
+
<% if @host.operatingsystem.family == 'Redhat' -%>
|
19
|
+
if ! [ $(id -u) -eq 0 ]; then
|
20
|
+
echo "You must run convert2rhel as a root user."
|
21
|
+
exit 1
|
22
|
+
fi
|
23
|
+
|
24
|
+
if ! rpm -q convert2rhel &> /dev/null; then
|
25
|
+
yum install -y convert2rhel
|
26
|
+
fi
|
27
|
+
|
28
|
+
<% if input('Data telemetry') != "yes" -%>
|
29
|
+
export CONVERT2RHEL_DISABLE_TELEMETRY=1
|
30
|
+
<% end -%>
|
31
|
+
|
32
|
+
/usr/bin/convert2rhel analyze -y
|
33
|
+
|
34
|
+
if ! grep -q ERROR /var/log/convert2rhel/convert2rhel-pre-conversion.json; then
|
35
|
+
echo "Error: Some error(s) have been found."
|
36
|
+
echo "Exiting ..."
|
37
|
+
exit 1
|
38
|
+
fi
|
39
|
+
|
40
|
+
if ! grep -q SKIP /var/log/convert2rhel/convert2rhel-pre-conversion.json; then
|
41
|
+
echo "Warning: Some check(s) have been skipped."
|
42
|
+
echo "Exiting ..."
|
43
|
+
exit 1
|
44
|
+
fi
|
45
|
+
<% else %>
|
46
|
+
echo 'Unsupported OS, it must be from the Red Hat family.'
|
47
|
+
exit 1
|
48
|
+
<% end -%>
|
data/config/routes.rb
CHANGED
@@ -92,6 +92,8 @@ Rails.application.routes.draw do
|
|
92
92
|
resources :foreign_input_sets, :only => [:index, :show, :create, :destroy, :update]
|
93
93
|
end
|
94
94
|
|
95
|
+
get 'hosts/:id/available_remote_execution_features', to: 'remote_execution_features#available_remote_execution_features'
|
96
|
+
|
95
97
|
resources :remote_execution_features, :only => [:show, :index, :update]
|
96
98
|
end
|
97
99
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class AddHostProxyInvocations < ActiveRecord::Migration[6.0]
|
2
2
|
def change
|
3
3
|
# rubocop:disable Rails/CreateTableWithTimestamps
|
4
|
-
create_table :host_proxy_invocations do |t|
|
4
|
+
create_table :host_proxy_invocations, if_not_exists: true do |t|
|
5
5
|
t.references :host, :null => false
|
6
6
|
t.references :smart_proxy, :null => false
|
7
7
|
end
|
8
8
|
# rubocop:enable Rails/CreateTableWithTimestamps
|
9
9
|
|
10
|
-
add_index :host_proxy_invocations, [:host_id, :smart_proxy_id], unique: true
|
10
|
+
add_index :host_proxy_invocations, [:host_id, :smart_proxy_id], unique: true, if_not_exists: true
|
11
11
|
end
|
12
12
|
end
|
@@ -178,7 +178,7 @@ module ForemanRemoteExecution
|
|
178
178
|
:'api/v2/template_inputs' => [:create, :update, :destroy],
|
179
179
|
:'api/v2/foreign_input_sets' => [:create, :update, :destroy]}, :resource_type => 'JobTemplate'
|
180
180
|
permission :edit_remote_execution_features, { :remote_execution_features => [:index, :show, :update],
|
181
|
-
:'api/v2/remote_execution_features' => [:index, :show, :update]}, :resource_type => 'RemoteExecutionFeature'
|
181
|
+
:'api/v2/remote_execution_features' => [:index, :show, :update, :available_remote_execution_features]}, :resource_type => 'RemoteExecutionFeature'
|
182
182
|
permission :destroy_job_templates, { :job_templates => [:destroy],
|
183
183
|
:'api/v2/job_templates' => [:destroy] }, :resource_type => 'JobTemplate'
|
184
184
|
permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
|
@@ -19,12 +19,18 @@ import { runFeature } from './actions';
|
|
19
19
|
|
20
20
|
const FeaturesDropdown = ({ hostId }) => {
|
21
21
|
const [isOpen, setIsOpen] = useState(false);
|
22
|
-
const {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
const { response, status } = useAPI(
|
23
|
+
'get',
|
24
|
+
foremanUrl(REX_FEATURES_API(hostId))
|
25
|
+
);
|
27
26
|
const dispatch = useDispatch();
|
27
|
+
// eslint-disable-next-line camelcase
|
28
|
+
const canRunJob = response?.permissions?.can_run_job;
|
29
|
+
if (!canRunJob) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
// eslint-disable-next-line camelcase
|
33
|
+
const features = response?.remote_execution_features;
|
28
34
|
const dropdownItems = features
|
29
35
|
?.filter(feature => feature.host_action_button)
|
30
36
|
?.map(({ name, label, id, description }) => (
|
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: 11.
|
4
|
+
version: 11.1.0
|
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: 2023-
|
11
|
+
date: 2023-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- app/views/api/v2/job_templates/main.json.rabl
|
231
231
|
- app/views/api/v2/job_templates/show.json.rabl
|
232
232
|
- app/views/api/v2/job_templates/update.json.rabl
|
233
|
+
- app/views/api/v2/remote_execution_features/available_remote_execution_features.json.rabl
|
233
234
|
- app/views/api/v2/remote_execution_features/base.json.rabl
|
234
235
|
- app/views/api/v2/remote_execution_features/index.json.rabl
|
235
236
|
- app/views/api/v2/remote_execution_features/main.json.rabl
|
@@ -281,6 +282,7 @@ files:
|
|
281
282
|
- app/views/template_invocations/show.html.erb
|
282
283
|
- app/views/template_invocations/show.js.erb
|
283
284
|
- app/views/templates/script/check_update.erb
|
285
|
+
- app/views/templates/script/convert2rhel_analyze.erb
|
284
286
|
- app/views/templates/script/module_action.erb
|
285
287
|
- app/views/templates/script/package_action.erb
|
286
288
|
- app/views/templates/script/power_action.erb
|
@@ -336,7 +338,7 @@ files:
|
|
336
338
|
- db/migrate/20200623073022_rename_sudo_password_to_effective_user_password.rb
|
337
339
|
- db/migrate/20200820122057_add_proxy_selector_override_to_remote_execution_feature.rb
|
338
340
|
- db/migrate/20210312074713_add_provider_inputs.rb
|
339
|
-
- db/migrate/
|
341
|
+
- db/migrate/20210517132916_add_host_proxy_invocations.rb
|
340
342
|
- db/migrate/20210816100932_rex_setting_category_to_dsl.rb
|
341
343
|
- db/migrate/20220321101835_rename_ssh_provider_to_script.rb
|
342
344
|
- db/migrate/20220331112719_add_ssh_user_to_job_invocation.rb
|