foreman_remote_execution_core 1.4.3 → 1.4.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd2b6c54e6301625e3ebbe35984e46343ba1a127ba76bc8838cfb3774a6b0648
|
4
|
+
data.tar.gz: 49a3b09e5893e8af012b6353ed6e3156596a144ffb07468ff6624cb9d4f32015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83d2db8fc7ba5a743508342a2ae2d54b3417f97cf1bec5ce7fc2cf9db6591924194d5d0c16856a6dfbb98e30d3ae75d557c14ee2ffa9013789bcb9456d812a8
|
7
|
+
data.tar.gz: 0f4124c1889b993ca6844673bfa3abc2bcf91088f0c008d972b678fa881a654949031e7527f4beb4a3e9e419dad1d70ae18c084e196f6dc9403c2cec5ce362fb
|
@@ -63,6 +63,7 @@ module ForemanRemoteExecutionCore
|
|
63
63
|
if ForemanTasksCore.dynflow_present?
|
64
64
|
require 'foreman_tasks_core/runner'
|
65
65
|
require 'foreman_remote_execution_core/log_filter'
|
66
|
+
require 'foreman_remote_execution_core/utils'
|
66
67
|
if simulate?
|
67
68
|
# Load the fake implementation of the script runner if debug is enabled
|
68
69
|
require 'foreman_remote_execution_core/fake_script_runner'
|
@@ -122,6 +122,7 @@ module ForemanRemoteExecutionCore
|
|
122
122
|
@local_working_dir = options.fetch(:local_working_dir, settings.fetch(:local_working_dir))
|
123
123
|
@remote_working_dir = options.fetch(:remote_working_dir, settings.fetch(:remote_working_dir))
|
124
124
|
@cleanup_working_dirs = options.fetch(:cleanup_working_dirs, settings.fetch(:cleanup_working_dirs))
|
125
|
+
@first_execution = options.fetch(:first_execution, false)
|
125
126
|
@user_method = user_method
|
126
127
|
end
|
127
128
|
|
@@ -149,11 +150,12 @@ module ForemanRemoteExecutionCore
|
|
149
150
|
end
|
150
151
|
|
151
152
|
def start
|
153
|
+
Utils.prune_known_hosts!(@host, @ssh_port, logger) if @first_execution
|
152
154
|
prepare_start
|
153
155
|
script = initialization_script
|
154
156
|
logger.debug("executing script:\n#{indent_multiline(script)}")
|
155
157
|
trigger(script)
|
156
|
-
rescue => e
|
158
|
+
rescue StandardError, NotImplementedError => e
|
157
159
|
logger.error("error while initalizing command #{e.class} #{e.message}:\n #{e.backtrace.join("\n")}")
|
158
160
|
publish_exception('Error initializing command', e)
|
159
161
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module ForemanRemoteExecutionCore
|
4
|
+
module Utils
|
5
|
+
class << self
|
6
|
+
def prune_known_hosts!(hostname, port, logger = Logger.new($stdout))
|
7
|
+
return if Net::SSH::KnownHosts.search_for(hostname).empty?
|
8
|
+
|
9
|
+
target = if port == 22
|
10
|
+
hostname
|
11
|
+
else
|
12
|
+
"[#{hostname}]:#{port}"
|
13
|
+
end
|
14
|
+
|
15
|
+
Open3.popen3('ssh-keygen', '-R', target) do |_stdin, stdout, _stderr, wait_thr|
|
16
|
+
wait_thr.join
|
17
|
+
stdout.read
|
18
|
+
end
|
19
|
+
rescue Errno::ENOENT => e
|
20
|
+
logger.warn("Could not remove #{hostname} from know_hosts: #{e}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.7
|
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: 2021-
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt_pbkdf
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/foreman_remote_execution_core/log_filter.rb
|
84
84
|
- lib/foreman_remote_execution_core/polling_script_runner.rb
|
85
85
|
- lib/foreman_remote_execution_core/script_runner.rb
|
86
|
+
- lib/foreman_remote_execution_core/utils.rb
|
86
87
|
- lib/foreman_remote_execution_core/version.rb
|
87
88
|
homepage: https://github.com/theforeman/foreman_remote_execution
|
88
89
|
licenses:
|