foreman_remote_execution 10.0.7 → 10.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af181ef9875f38effa38fa61b6d62401aea97323babcc545c111b85bc38a2fe0
4
- data.tar.gz: a19d3bbcb041e403607b00d7ed92bcaa05a916e80ea251c80357064167b9d0f8
3
+ metadata.gz: d3858e769f34f6ba3dee6ec49580e170d15e14842712adec898712a9cd838f4d
4
+ data.tar.gz: 9d9d61ce4c72fe8832dec9ebe71150af550fc205e3b9ab786b86712bea5f7bb3
5
5
  SHA512:
6
- metadata.gz: 1cb79a08c9d8f24d236fe744ff0a8fd87c7c071ab9678b00ac1ca2871be4d5c2fb21bd22d430cc560fa4a41ed757cd836fc08a17ba7c421521c019f853d247fb
7
- data.tar.gz: 5130853eed2121e2968fc6a9058c6972a3c9a39a490e4e51852c6fb365ce0d803f86df08ec67cfa8ba3f38c47272e7ab865c4f5769eede3dea0f86d69992d637
6
+ metadata.gz: 684796e979b40fed3ffd326af42ceb7ba86b95c5dc66d54b827093abba8a8df07d805fe2ab098b0e69e028186d6a39ce9473e744d440ade103258c4f39f9d96c
7
+ data.tar.gz: b61cb917b524dfe9368c16b615b8cb93dfa519893090c186865b43d4befb6442dff749435247ffe6148eed231b1fec163cb2af3ffc00d6c0b6dddf78cc10ff57
@@ -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,43 @@
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
+ <% else %>
41
+ echo 'Unsupported OS, it must be from the Red Hat family.'
42
+ exit 1
43
+ <% 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.1'.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.1
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-11-14 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