foreman-tasks-core 0.1.2 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e2b37c0d8ce49360cb333bd3e5468f0c96c64bf
|
4
|
+
data.tar.gz: 4b5be57f5f8a47415581f7c70182050891e5fbcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efcf179686dce26f852bfd443f8c0e9e5e624ae8630711b8ebce454fa8cf9b6e251220d729e255da034d33eeecd309cd272c5b8eb6d7b749bf7c773e5ed287c1
|
7
|
+
data.tar.gz: 4d388300b3d9ff1fe0ccff4f7962fd5fd543522085bcde9170ab1ff08795ceaecfbb7b06b1ae16348167fc03fa054b006e54f3cb9bfdb1d2fd8c9bd8f21a404a
|
@@ -8,7 +8,7 @@ module ForemanTasksCore
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def add_raw_output(raw_output)
|
11
|
-
missing_args = %w
|
11
|
+
missing_args = %w[output_type output timestamp] - raw_output.keys
|
12
12
|
unless missing_args.empty?
|
13
13
|
raise ArgumentError, "Missing args for raw output: #{missing_args.inspect}"
|
14
14
|
end
|
@@ -41,6 +41,17 @@ module ForemanTasksCore
|
|
41
41
|
# if cleanup is needed
|
42
42
|
end
|
43
43
|
|
44
|
+
def timeout
|
45
|
+
# Override when timeouts and regular kills should be handled differently
|
46
|
+
publish_data('Timeout for execution passed, trying to stop the job', 'debug')
|
47
|
+
kill
|
48
|
+
end
|
49
|
+
|
50
|
+
def timeout_interval
|
51
|
+
# A number of seconds after which the runner should receive a #timeout
|
52
|
+
# or nil for no timeout
|
53
|
+
end
|
54
|
+
|
44
55
|
def publish_data(data, type)
|
45
56
|
@continuous_output.add_output(data, type)
|
46
57
|
end
|
@@ -26,6 +26,7 @@ module ForemanTasksCore
|
|
26
26
|
|
27
27
|
def start_runner
|
28
28
|
@logger.debug("start runner #{@runner.id}")
|
29
|
+
set_timeout if @runner.timeout_interval
|
29
30
|
@runner.start
|
30
31
|
refresh_runner
|
31
32
|
ensure
|
@@ -43,6 +44,13 @@ module ForemanTasksCore
|
|
43
44
|
plan_next_refresh
|
44
45
|
end
|
45
46
|
|
47
|
+
def timeout_runner
|
48
|
+
@logger.debug("timeout runner #{@runner.id}")
|
49
|
+
@runner.timeout
|
50
|
+
rescue => e
|
51
|
+
handle_exception(e, false)
|
52
|
+
end
|
53
|
+
|
46
54
|
def kill
|
47
55
|
@logger.debug("kill runner #{@runner.id}")
|
48
56
|
@runner.kill
|
@@ -65,6 +73,12 @@ module ForemanTasksCore
|
|
65
73
|
|
66
74
|
private
|
67
75
|
|
76
|
+
def set_timeout
|
77
|
+
timeout_time = Time.now.getlocal + @runner.timeout_interval
|
78
|
+
@logger.debug("setting timeout for #{@runner.id} to #{timeout_time}")
|
79
|
+
@clock.ping(reference, timeout_time, :timeout_runner)
|
80
|
+
end
|
81
|
+
|
68
82
|
def plan_next_refresh
|
69
83
|
if !@finishing && !@refresh_planned
|
70
84
|
@logger.debug("planning to refresh #{@runner.id}")
|
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
'
|
13
|
+
description: |
|
14
|
+
Common code used both at Forman and Foreman proxy regarding tasks
|
16
15
|
email:
|
17
16
|
- inecas@redhat.com
|
18
17
|
executables: []
|
@@ -50,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
49
|
version: '0'
|
51
50
|
requirements: []
|
52
51
|
rubyforge_project:
|
53
|
-
rubygems_version: 2.5
|
52
|
+
rubygems_version: 2.4.5
|
54
53
|
signing_key:
|
55
54
|
specification_version: 4
|
56
55
|
summary: Common code used both at Forman and Foreman proxy regarding tasks
|