foreman_remote_execution_core 1.4.3 → 1.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbe9c8dca2b75119ee1cd438a921c11404346a59b5e967b4e282a3ad51646699
|
4
|
+
data.tar.gz: ed32bfa0d9f7a0324439cccaa834ae6d5da4be100ef9f537eac0db6d7dcd717e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3de877ddc3fdbeed51b03164aee40920ccd977007053f995d8e7c8edd32990cd9d390c1049881a1eda46fb7e502dc7fb213a947e847aadf2b38bd24363aa15a6
|
7
|
+
data.tar.gz: aaab475a03bfbfcd21e2cdc7a3c172b9e4bd13bb496fb79eabe18fa299e0e0b47c33ea1d72845d2291ec49399a71a092eaa06940ae097a71fa333c5f170d1d0e
|
@@ -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,6 +150,7 @@ 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)}")
|
@@ -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.4
|
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-07-13 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:
|