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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55e82e90cf59b891182ce42ad09eecc0459ed11e87fbaf771876a079ad18d1df
4
- data.tar.gz: 8e0468a5c1c8be4a026afaa4ec4c7d374e65cc8e0454b3ee2713cd65105af69e
3
+ metadata.gz: '019c69e822a9bf8be86315b9cbdf83901e05e0209c115c82a815e92bf0f912e8'
4
+ data.tar.gz: 7349a60661ccf18d18874a4332a0267dfc535c29fc3871182898dbd8bcf70091
5
5
  SHA512:
6
- metadata.gz: d506028f4cda6a41a271318746f0cd4258848418a63bb8ff4fc4878ee9b0dfd255f2eec27e29c02f7cffdebb8c15fde90e958f55209582af9d0480fca8b3cce9
7
- data.tar.gz: 938195c3fff09e765bf46c646a2b244401d8fe8be8167808c56163059768ee8c3a39468ec3f663b3afd42f92ae3612f432162c65a34e284195399990c47d86b8
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,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
@@ -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'
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '11.0.0'.freeze
2
+ VERSION = '11.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: 11.0.0
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-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
@@ -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/2021051713291621250977_add_host_proxy_invocations.rb
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