foreman_remote_execution 4.5.3 → 4.5.4

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: 812237a4d9fd4c4000c8522be1ecdaf539f8ca15e9b6e63a599da92419ade6f4
4
- data.tar.gz: 8a0c5f90892a268816c0b16184faef14b55a36f60fdd0750303291d0688ba83f
3
+ metadata.gz: 8db3f88983ab094bd33ad6cd7630fdc57924e73ba196b1393c1369512cbd3307
4
+ data.tar.gz: 8bdaa93cdeabbb00ff6af832842c2fc1bb6437b0f3467db511e86cf22a5742bd
5
5
  SHA512:
6
- metadata.gz: a572fa58d1c7b1776c5493afdb9e2940f97e03a996e5e56c5ed633497b825a8e77b2013a7570c8990403f3f2e0f197036aee556c7177cae3fb6feac585f5c95b
7
- data.tar.gz: 57d64d09cbd7b14984564201e53df9a76bd6e95fc7008283e506924813d7ee18996ece236d2d6258da4f61a8a56816491b9b690a01f36e0a94de364db4c5ba64
6
+ metadata.gz: 6b03559c1efa565ec741874f4213ec86dcd4115b4dcf896c9846100033429baa5bbe1df427f8f2e4a4202d62e9dbc8768358bc3034d86362bb1d40236061c2f4
7
+ data.tar.gz: 7091c88b57902cadf6c59959563d25332a89731f9a2da44a267bcd5207611a3256c31b0971f0cd9f2dca05186a07e5f86fb1361ac47d9d69bd11d61df6628e69
@@ -7,7 +7,9 @@ module ForemanRemoteExecution
7
7
  end
8
8
 
9
9
  def multiple_actions
10
- super + [ [_('Schedule Remote Job'), new_job_invocation_path, false] ]
10
+ res = super
11
+ res += [ [_('Schedule Remote Job'), new_job_invocation_path, false] ] if authorized_for(controller: :job_invocations, action: :new)
12
+ res
11
13
  end
12
14
 
13
15
  def schedule_job_multi_button(*args)
@@ -21,12 +23,14 @@ module ForemanRemoteExecution
21
23
  end
22
24
 
23
25
  def rex_host_features(*args)
26
+ return unless authorized_for(controller: :job_invocations, action: :create)
24
27
  RemoteExecutionFeature.with_host_action_button.order(:label).map do |feature|
25
28
  link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [args.first.id], :feature => feature.label), :method => :post)
26
29
  end
27
30
  end
28
31
 
29
32
  def schedule_job_button(*args)
33
+ return unless authorized_for(controller: :job_invocations, action: :new)
30
34
  link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button, :class => 'btn btn-default')
31
35
  end
32
36
 
@@ -113,12 +113,14 @@ module RemoteExecutionHelper
113
113
  :class => 'btn btn-danger',
114
114
  :title => _('Try to cancel the job on a host'),
115
115
  :disabled => !task.cancellable?,
116
- :method => :post)
116
+ :method => :post,
117
+ :remote => true)
117
118
  buttons << link_to(_('Abort Job'), abort_foreman_tasks_task_path(task),
118
119
  :class => 'btn btn-danger',
119
120
  :title => _('Try to abort the job on a host without waiting for its result'),
120
121
  :disabled => !task.cancellable?,
121
- :method => :post)
122
+ :method => :post,
123
+ :remote => true)
122
124
  end
123
125
  buttons
124
126
  end
@@ -72,7 +72,7 @@ module Actions
72
72
 
73
73
  def total_count
74
74
  # For compatibility with already existing tasks
75
- return output[:total_count] unless output.has_key?(:host_count) || task.pending?
75
+ return output[:total_count] || hosts.count unless output.has_key?(:host_count) || task.pending?
76
76
 
77
77
  output[:host_count] || hosts.count
78
78
  end
@@ -209,7 +209,7 @@ class JobInvocationComposer
209
209
  def format_datetime(datetime)
210
210
  return datetime if datetime.blank?
211
211
 
212
- Time.parse(datetime).strftime('%Y-%m-%d %H:%M')
212
+ Time.parse(datetime).utc.strftime('%Y-%m-%d %H:%M')
213
213
  end
214
214
  end
215
215
 
@@ -296,7 +296,7 @@ class JobInvocationComposer
296
296
  attr_reader :feature_label, :feature, :provided_inputs
297
297
 
298
298
  def initialize(feature_label, hosts, provided_inputs = {})
299
- @feature = RemoteExecutionFeature.feature(feature_label)
299
+ @feature = RemoteExecutionFeature.feature!(feature_label)
300
300
  @provided_inputs = provided_inputs
301
301
  translator = HostIdsTranslator.new(hosts)
302
302
  @host_bookmark = translator.bookmark
@@ -20,7 +20,11 @@ class RemoteExecutionFeature < ApplicationRecord
20
20
  end
21
21
 
22
22
  def self.feature(label)
23
- self.find_by(label: label) || raise(::Foreman::Exception.new(N_('Unknown remote execution feature %s'), label))
23
+ self.find_by(label: label)
24
+ end
25
+
26
+ def self.feature!(label)
27
+ feature(label) || raise(::Foreman::Exception.new(N_('Unknown remote execution feature %s'), label))
24
28
  end
25
29
 
26
30
  def self.register(label, name, options = {})
@@ -13,6 +13,8 @@ template_inputs:
13
13
  required: true
14
14
  %>
15
15
 
16
+ PATH="$PATH:/usr/sbin:/sbin"
17
+
16
18
  echo <%= input('action') %> host && sleep 3
17
19
  <%= case input('action')
18
20
  when 'restart'
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '4.5.3'.freeze
2
+ VERSION = '4.5.4'.freeze
3
3
  end
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: 4.5.3
4
+ version: 4.5.4
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: 2021-07-27 00:00:00.000000000 Z
11
+ date: 2021-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface