foreman_remote_execution 10.0.7 → 10.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af181ef9875f38effa38fa61b6d62401aea97323babcc545c111b85bc38a2fe0
4
- data.tar.gz: a19d3bbcb041e403607b00d7ed92bcaa05a916e80ea251c80357064167b9d0f8
3
+ metadata.gz: 25c5d179ccedf9911c0f95df7a9c020567b350a668923a589462b89d9fbe056e
4
+ data.tar.gz: f49191c9a787288bbf00e1049ae65aa9633fb2b06e5491eb690f463f59d29442
5
5
  SHA512:
6
- metadata.gz: 1cb79a08c9d8f24d236fe744ff0a8fd87c7c071ab9678b00ac1ca2871be4d5c2fb21bd22d430cc560fa4a41ed757cd836fc08a17ba7c421521c019f853d247fb
7
- data.tar.gz: 5130853eed2121e2968fc6a9058c6972a3c9a39a490e4e51852c6fb365ce0d803f86df08ec67cfa8ba3f38c47272e7ab865c4f5769eede3dea0f86d69992d637
6
+ metadata.gz: ece23e8faa1a113183be16083d6ffee2cfeb8d0e3c460272f9ba017f9eeac692fac95f4a7f87629cbf58d0974da039fd52e74476b05a47e029efd1f6104ed3d2
7
+ data.tar.gz: c4891b7a8a43ec390d7b50d1bb3a7da6b19fc667a0e53d4551dd7e235da29e1bdabcf5c431e038a386e30e43a396b06e957f0fcf1366692d786b5e8778618838
@@ -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,6 @@
1
+ node :permissions do
2
+ @permissions
3
+ end
4
+ child @remote_execution_features do
5
+ extends 'api/v2/remote_execution_features/main'
6
+ end
@@ -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
@@ -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'
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '10.0.7'.freeze
2
+ VERSION = '10.1.0'.freeze
3
3
  end
@@ -1,2 +1,3 @@
1
- export const REX_FEATURES_API = '/api/remote_execution_features';
1
+ export const REX_FEATURES_API = host =>
2
+ `/api/v2/hosts/${host}/available_remote_execution_features`;
2
3
  export const NEW_JOB_PAGE = '/job_invocations/new?host_ids%5B%5D';
@@ -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
- response: { results: features },
24
- status,
25
- } = useAPI('get', foremanUrl(REX_FEATURES_API));
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: 10.0.7
4
+ version: 10.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-08-29 00:00:00.000000000 Z
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