foreman_remote_execution 1.3.2 → 1.3.3

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
  SHA1:
3
- metadata.gz: ba7dfa6dd3c06e3240541005c42afc45c5d2c61f
4
- data.tar.gz: b6985d294864cc4e69919ccf6ec6d7a29478e674
3
+ metadata.gz: bb2c9a95f22cf5c9002035f47adfc90eee494da5
4
+ data.tar.gz: 75e9a15b54a3832e112c5b8d2706a3a353f48e86
5
5
  SHA512:
6
- metadata.gz: e3cb2b3678b4127b56ac9b37a7983e42d283a0728204f22c47c319d17878c5eff268cb327311b7d64e74cbef7a750217f2b98b7ef81ce4be1a87dd7695253b85
7
- data.tar.gz: 5a8f1dc7ff728d443decf1047246e1f11bb87bed37df736b6baa3a19da3ea28797740533d8cb199ed3c93325bdcccaf6a02cd109b7c557f60234cb4654ef2e1e
6
+ metadata.gz: af011f877cc95f1bf64cb3dd5c8633de7d0fd2aa6a445d15925c78950a50e636acdd298660b0c6970d2c4f17b53a492a51282004011a0fe5ac030ebed57bae3d
7
+ data.tar.gz: 4d8e436256f46a252dc95987de9e1749c41852baf2e33f837dc6465bcf802d84781ac6e5eac307b2717d2bbbd18b594cac8a9fecc1a0a6adb741edf7dfd1965f
@@ -43,8 +43,11 @@ class JobInvocationsController < ApplicationController
43
43
  @job_invocation = resource_base.includes(:template_invocations => :run_host_job_task).find(params[:id])
44
44
  @auto_refresh = @job_invocation.task.try(:pending?)
45
45
  hosts_base = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)
46
- .joins(:template_invocations)
47
- .merge(TemplateInvocation.where(:job_invocation_id => @job_invocation.id))
46
+ # There's no need to do the joining if we're not filtering
47
+ unless params[:search].nil?
48
+ hosts_base = hosts_base.joins(:template_invocations)
49
+ .where(:template_invocations => { :job_invocation_id => @job_invocation.id})
50
+ end
48
51
  @hosts = hosts_base.search_for(params[:search], :order => params[:order] || 'name ASC').paginate(:page => params[:page])
49
52
  end
50
53
 
@@ -7,18 +7,18 @@ module Actions
7
7
  middleware.use Actions::Middleware::BindJobInvocation
8
8
  middleware.use Actions::Middleware::RecurringLogic
9
9
 
10
- def delay(delay_options, job_invocation, locked = false)
10
+ def delay(delay_options, job_invocation)
11
11
  task.add_missing_task_groups(job_invocation.task_group)
12
- job_invocation.targeting.resolve_hosts! if job_invocation.targeting.static?
13
- super delay_options, job_invocation, locked
12
+ job_invocation.targeting.resolve_hosts! if job_invocation.targeting.static? && !job_invocation.targeting.resolved?
13
+ super delay_options, job_invocation
14
14
  end
15
15
 
16
- def plan(job_invocation, locked = false)
16
+ def plan(job_invocation)
17
17
  set_up_concurrency_control job_invocation
18
18
  job_invocation.task_group.save! if job_invocation.task_group.try(:new_record?)
19
19
  task.add_missing_task_groups(job_invocation.task_group) if job_invocation.task_group
20
- action_subject(job_invocation) unless locked
21
- job_invocation.targeting.resolve_hosts! if job_invocation.targeting.dynamic? || !locked
20
+ action_subject(job_invocation)
21
+ job_invocation.targeting.resolve_hosts! if job_invocation.targeting.dynamic? || !job_invocation.targeting.resolved?
22
22
  input.update(:job_category => job_invocation.job_category)
23
23
  plan_self(:job_invocation_id => job_invocation.id)
24
24
  end
@@ -15,7 +15,7 @@
15
15
 
16
16
  <%= select_f f, :provider_type, providers_options, :first, :last, :disabled => @template.locked? %>
17
17
 
18
- <%= number_f f, :timeout_interval, :disabled => @template.locked?, :label => _('Timeout interval') %>
18
+ <%= number_f f, :execution_timeout_interval, :disabled => @template.locked?, :label => _('Timeout to kill') %>
19
19
 
20
20
  <div class="children_fields">
21
21
  <%= new_child_fields_template(f, :template_inputs, { :partial => "template_inputs/form" }) %>
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '1.3.2'.freeze
2
+ VERSION = '1.3.3'.freeze
3
3
  end
@@ -37,9 +37,34 @@ module ForemanRemoteExecution
37
37
  action
38
38
  end
39
39
 
40
- it 'resolves the hosts on targeting in plan phase' do
41
- planned
42
- targeting.hosts.must_include(host)
40
+ context 'targeting resolving' do
41
+ let(:delayed) do
42
+ action.delay({ :start_at => Time.now.getlocal }, job_invocation)
43
+ action
44
+ end
45
+
46
+ it 'resolves dynamic targeting in plan' do
47
+ targeting.targeting_type = 'dynamic_query'
48
+ refute targeting.resolved?
49
+ delayed
50
+ refute targeting.resolved?
51
+ planned
52
+ targeting.hosts.must_include(host)
53
+ end
54
+
55
+ it 'resolves the hosts on static targeting in delay' do
56
+ refute targeting.resolved?
57
+ delayed
58
+ targeting.hosts.must_include(host)
59
+ # Verify Targeting#resolve_hosts! won't be hit again
60
+ targeting.expects(:resolve_hosts!).never
61
+ planned
62
+ end
63
+
64
+ it 'resolves the hosts on static targeting in plan phase if not resolved yet' do
65
+ planned
66
+ targeting.hosts.must_include(host)
67
+ end
43
68
  end
44
69
 
45
70
  it 'triggers the RunHostJob actions on the resolved hosts in run phase' do
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: 1.3.2
4
+ version: 1.3.3
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: 2017-07-11 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface