foreman_remote_execution 10.0.6 → 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: 0d1dfb7b78f7d6b17a97fe16984983f966bb6f4bb8598601923fabccb31a31ff
4
- data.tar.gz: ba03ab056e8d4fd77b61f3dee350c9aa8c029849e1837abe687fd138c5bf8f7a
3
+ metadata.gz: 25c5d179ccedf9911c0f95df7a9c020567b350a668923a589462b89d9fbe056e
4
+ data.tar.gz: f49191c9a787288bbf00e1049ae65aa9633fb2b06e5491eb690f463f59d29442
5
5
  SHA512:
6
- metadata.gz: d246ff28f82ce483e189979542a02c7e5e35e850ca61761d73ae11468cfc152593571c5e9aee562b2869b80c3201885812bc779fb82d2138c61725ac203d5c50
7
- data.tar.gz: f970e87c94079104ea58f7654559d3bf4b0ca02af756e7ac63201a0608ac3010c6502a68492d635f1daa62690c4e501739c53932c9da2a300aa56d84801e6a55
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.6'.freeze
2
+ VERSION = '10.1.0'.freeze
3
3
  end
@@ -76,7 +76,7 @@ export const useAutoFill = ({
76
76
  if (typeof rest[key] === 'string') {
77
77
  setTemplateValues(prev => ({ ...prev, [input]: rest[key] }));
78
78
  setAdvancedValues(prev => ({ ...prev, [input]: rest[key] }));
79
- } else {
79
+ } else if (rest[key].value !== null) {
80
80
  const { value, advanced } = rest[key];
81
81
  if (advanced) {
82
82
  setAdvancedValues(prev => ({
@@ -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.6
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-14 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
@@ -561,7 +563,7 @@ homepage: https://github.com/theforeman/foreman_remote_execution
561
563
  licenses:
562
564
  - GPL-3.0
563
565
  metadata: {}
564
- post_install_message:
566
+ post_install_message:
565
567
  rdoc_options: []
566
568
  require_paths:
567
569
  - lib
@@ -576,8 +578,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
576
578
  - !ruby/object:Gem::Version
577
579
  version: '0'
578
580
  requirements: []
579
- rubygems_version: 3.4.17
580
- signing_key:
581
+ rubygems_version: 3.1.6
582
+ signing_key:
581
583
  specification_version: 4
582
584
  summary: A plugin bringing remote execution to the Foreman, completing the config
583
585
  management functionality with remote management functionality.