foreman_remote_execution_core 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a81b2a41e08c662ce352dd037d625bd42cb9d53a
|
4
|
+
data.tar.gz: a5294079e9132731210ebe670f2f7c1810639cdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04e246d897664d62109be19680cb4c973dac71868385b228f1257de2d923a8523fc12d9cdbbb2c167de092f8703fcea26459d0363ac8f005344d40a1afe8b484
|
7
|
+
data.tar.gz: 8ab7a7eb9c9accc486c975896aaf70f3671e95ca1ab2f9509d56832c6985185e45a74c0b5a4fe7fef11aa4c9f30e97ffca62d995889e16b8d03967c157a871d5
|
@@ -1,7 +1,15 @@
|
|
1
1
|
require 'net/ssh'
|
2
2
|
|
3
|
+
# rubocop:disable Lint/HandleExceptions
|
4
|
+
begin
|
5
|
+
require 'net/ssh/krb'
|
6
|
+
rescue LoadError; end
|
7
|
+
# rubocop:enable Lint/HandleExceptions:
|
8
|
+
|
3
9
|
module ForemanRemoteExecutionCore
|
4
10
|
class ScriptRunner < ForemanTasksCore::Runner::Base
|
11
|
+
attr_reader :execution_timeout_interval
|
12
|
+
|
5
13
|
EXPECTED_POWER_ACTION_MESSAGES = ['restart host', 'shutdown host'].freeze
|
6
14
|
|
7
15
|
def initialize(options)
|
@@ -14,6 +22,7 @@ module ForemanRemoteExecutionCore
|
|
14
22
|
@effective_user_method = options.fetch(:effective_user_method, 'sudo')
|
15
23
|
@host_public_key = options.fetch(:host_public_key, nil)
|
16
24
|
@verify_host = options.fetch(:verify_host, nil)
|
25
|
+
@execution_timeout_interval = options.fetch(:execution_timeout_interval, nil)
|
17
26
|
|
18
27
|
@client_private_key_file = settings.fetch(:ssh_identity_key_file)
|
19
28
|
@local_working_dir = options.fetch(:local_working_dir, settings.fetch(:local_working_dir))
|
@@ -61,6 +70,15 @@ module ForemanRemoteExecutionCore
|
|
61
70
|
publish_exception('Unexpected error', e, false)
|
62
71
|
end
|
63
72
|
|
73
|
+
def timeout
|
74
|
+
@logger.debug('job timed out')
|
75
|
+
super
|
76
|
+
end
|
77
|
+
|
78
|
+
def timeout_interval
|
79
|
+
execution_timeout_interval
|
80
|
+
end
|
81
|
+
|
64
82
|
def with_retries
|
65
83
|
tries = 0
|
66
84
|
begin
|
@@ -93,6 +111,10 @@ module ForemanRemoteExecutionCore
|
|
93
111
|
@session.close if @session && !@session.closed?
|
94
112
|
end
|
95
113
|
|
114
|
+
def publish_data(data, type)
|
115
|
+
super(data.force_encoding('UTF-8'), type)
|
116
|
+
end
|
117
|
+
|
96
118
|
private
|
97
119
|
|
98
120
|
def session
|
@@ -111,7 +133,7 @@ module ForemanRemoteExecutionCore
|
|
111
133
|
# if the host public key is contained in the known_hosts_file,
|
112
134
|
# verify it, otherwise, if missing, import it and continue
|
113
135
|
ssh_options[:paranoid] = true
|
114
|
-
ssh_options[:auth_methods] =
|
136
|
+
ssh_options[:auth_methods] = available_authentication_methods
|
115
137
|
ssh_options[:user_known_hosts_file] = prepare_known_hosts if @host_public_key
|
116
138
|
return ssh_options
|
117
139
|
end
|
@@ -279,5 +301,17 @@ module ForemanRemoteExecutionCore
|
|
279
301
|
@expecting_disconnect = true
|
280
302
|
end
|
281
303
|
end
|
304
|
+
|
305
|
+
def available_authentication_methods
|
306
|
+
methods = %w(publickey) # Always use pubkey auth as fallback
|
307
|
+
if settings[:kerberos_auth]
|
308
|
+
if defined? Net::SSH::Kerberos
|
309
|
+
methods << 'gssapi-with-mic'
|
310
|
+
else
|
311
|
+
@logger.warn('Kerberos authentication requested but not available')
|
312
|
+
end
|
313
|
+
end
|
314
|
+
methods
|
315
|
+
end
|
282
316
|
end
|
283
317
|
end
|
@@ -6,7 +6,8 @@ module ForemanRemoteExecutionCore
|
|
6
6
|
:ssh_identity_key_file => '~/.ssh/id_rsa_foreman_proxy',
|
7
7
|
:ssh_user => 'root',
|
8
8
|
:remote_working_dir => '/var/tmp',
|
9
|
-
:local_working_dir => '/var/tmp'
|
9
|
+
:local_working_dir => '/var/tmp',
|
10
|
+
:kerberos_auth => false)
|
10
11
|
|
11
12
|
def self.simulate?
|
12
13
|
%w(yes true 1).include? ENV.fetch('REX_SIMULATE', '').downcase
|
metadata
CHANGED
@@ -1,45 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
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-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman-tasks-core
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: net-ssh
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
19
|
+
version: 0.1.3
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
26
|
+
version: 0.1.3
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: net-
|
28
|
+
name: net-ssh
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|