smart_proxy_remote_execution_ssh 0.4.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{bundler.plugins.d → bundler.d}/remote_execution_ssh.rb +0 -0
- data/lib/smart_proxy_remote_execution_ssh/actions/pull_script.rb +110 -0
- data/lib/smart_proxy_remote_execution_ssh/actions/run_script.rb +16 -2
- data/lib/smart_proxy_remote_execution_ssh/actions.rb +6 -0
- data/lib/smart_proxy_remote_execution_ssh/api.rb +49 -0
- data/lib/smart_proxy_remote_execution_ssh/cockpit.rb +87 -71
- data/lib/smart_proxy_remote_execution_ssh/dispatcher.rb +2 -2
- data/lib/smart_proxy_remote_execution_ssh/job_storage.rb +51 -0
- data/lib/smart_proxy_remote_execution_ssh/net_ssh_compat.rb +228 -0
- data/lib/smart_proxy_remote_execution_ssh/plugin.rb +13 -7
- data/lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb +1 -1
- data/lib/smart_proxy_remote_execution_ssh/runners/polling_script_runner.rb +5 -6
- data/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb +86 -133
- data/lib/smart_proxy_remote_execution_ssh/utils.rb +24 -0
- data/lib/smart_proxy_remote_execution_ssh/version.rb +1 -1
- data/lib/smart_proxy_remote_execution_ssh.rb +37 -6
- data/settings.d/remote_execution_ssh.yml.example +10 -4
- metadata +19 -14
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'foreman_tasks_core'
|
2
|
-
require 'smart_proxy_remote_execution_ssh/version'
|
3
1
|
require 'smart_proxy_dynflow'
|
4
|
-
require 'smart_proxy_remote_execution_ssh/
|
2
|
+
require 'smart_proxy_remote_execution_ssh/version'
|
5
3
|
require 'smart_proxy_remote_execution_ssh/plugin'
|
4
|
+
require 'smart_proxy_remote_execution_ssh/webrick_ext'
|
6
5
|
|
7
6
|
module Proxy::RemoteExecution
|
8
7
|
module Ssh
|
@@ -21,7 +20,9 @@ module Proxy::RemoteExecution
|
|
21
20
|
raise "Ssh public key file #{public_key_file} doesn't exist"
|
22
21
|
end
|
23
22
|
|
23
|
+
validate_mode!
|
24
24
|
validate_ssh_log_level!
|
25
|
+
validate_mqtt_settings!
|
25
26
|
end
|
26
27
|
|
27
28
|
def private_key_file
|
@@ -32,6 +33,35 @@ module Proxy::RemoteExecution
|
|
32
33
|
File.expand_path("#{private_key_file}.pub")
|
33
34
|
end
|
34
35
|
|
36
|
+
def validate_mode!
|
37
|
+
Plugin.settings.mode = Plugin.settings.mode.to_sym
|
38
|
+
|
39
|
+
unless Plugin::MODES.include? Plugin.settings.mode
|
40
|
+
raise "Mode has to be one of #{Plugin::MODES.join(', ')}, given #{Plugin.settings.mode}"
|
41
|
+
end
|
42
|
+
|
43
|
+
if Plugin.settings.async_ssh
|
44
|
+
Plugin.logger.warn('Option async_ssh is deprecated, use ssh-async mode instead.')
|
45
|
+
|
46
|
+
case Plugin.settings.mode
|
47
|
+
when :ssh
|
48
|
+
Plugin.logger.warn('Deprecated option async_ssh used together with ssh mode, switching mode to ssh-async.')
|
49
|
+
Plugin.settings.mode = :'ssh-async'
|
50
|
+
when :'ssh-async'
|
51
|
+
# This is a noop
|
52
|
+
else
|
53
|
+
Plugin.logger.warn('Deprecated option async_ssh used together with incompatible mode, ignoring.')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def validate_mqtt_settings!
|
59
|
+
return unless Plugin.settings.mode == :'pull-mqtt'
|
60
|
+
|
61
|
+
raise 'mqtt_broker has to be set when pull-mqtt mode is used' if Plugin.settings.mqtt_broker.nil?
|
62
|
+
raise 'mqtt_port has to be set when pull-mqtt mode is used' if Plugin.settings.mqtt_port.nil?
|
63
|
+
end
|
64
|
+
|
35
65
|
def validate_ssh_log_level!
|
36
66
|
wanted_level = Plugin.settings.ssh_log_level.to_s
|
37
67
|
levels = Plugin::SSH_LOG_LEVELS
|
@@ -52,9 +82,10 @@ module Proxy::RemoteExecution
|
|
52
82
|
|
53
83
|
Plugin.settings.ssh_log_level = Plugin.settings.ssh_log_level.to_sym
|
54
84
|
end
|
55
|
-
end
|
56
85
|
|
57
|
-
|
58
|
-
|
86
|
+
def job_storage
|
87
|
+
@job_storage ||= Proxy::RemoteExecution::Ssh::JobStorage.new
|
88
|
+
end
|
89
|
+
end
|
59
90
|
end
|
60
91
|
end
|
@@ -4,17 +4,23 @@
|
|
4
4
|
:local_working_dir: '/var/tmp'
|
5
5
|
:remote_working_dir: '/var/tmp'
|
6
6
|
# :kerberos_auth: false
|
7
|
-
|
7
|
+
|
8
|
+
# Mode of operation, one of ssh, ssh-async, pull, pull-mqtt
|
9
|
+
:mode: ssh
|
8
10
|
|
9
11
|
# Defines how often (in seconds) should the runner check
|
10
12
|
# for new data leave empty to use the runner's default
|
11
13
|
# (1 second for regular, 60 seconds with async_ssh enabled)
|
12
14
|
# :runner_refresh_interval:
|
13
15
|
|
14
|
-
# Defines the verbosity of logging coming from
|
15
|
-
# one of :debug, :info, :
|
16
|
+
# Defines the verbosity of logging coming from ssh command
|
17
|
+
# one of :debug, :info, :error, :fatal
|
16
18
|
# must be lower than general log level
|
17
|
-
# :ssh_log_level:
|
19
|
+
# :ssh_log_level: error
|
18
20
|
|
19
21
|
# Remove working directories on job completion
|
20
22
|
# :cleanup_working_dirs: true
|
23
|
+
|
24
|
+
# MQTT configuration, need to be set if mode is set to pull-mqtt
|
25
|
+
# :mqtt_broker: localhost
|
26
|
+
# :mqtt_port: 1883
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_remote_execution_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
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:
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,35 +109,35 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.82.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: smart_proxy_dynflow
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: '0.5'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: '0.5'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: net-ssh
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 4.2.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 4.2.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: mqtt
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -161,8 +161,10 @@ extra_rdoc_files:
|
|
161
161
|
files:
|
162
162
|
- LICENSE
|
163
163
|
- README.md
|
164
|
-
- bundler.
|
164
|
+
- bundler.d/remote_execution_ssh.rb
|
165
165
|
- lib/smart_proxy_remote_execution_ssh.rb
|
166
|
+
- lib/smart_proxy_remote_execution_ssh/actions.rb
|
167
|
+
- lib/smart_proxy_remote_execution_ssh/actions/pull_script.rb
|
166
168
|
- lib/smart_proxy_remote_execution_ssh/actions/run_script.rb
|
167
169
|
- lib/smart_proxy_remote_execution_ssh/api.rb
|
168
170
|
- lib/smart_proxy_remote_execution_ssh/async_scripts/control.sh
|
@@ -170,12 +172,15 @@ files:
|
|
170
172
|
- lib/smart_proxy_remote_execution_ssh/cockpit.rb
|
171
173
|
- lib/smart_proxy_remote_execution_ssh/dispatcher.rb
|
172
174
|
- lib/smart_proxy_remote_execution_ssh/http_config.ru
|
175
|
+
- lib/smart_proxy_remote_execution_ssh/job_storage.rb
|
173
176
|
- lib/smart_proxy_remote_execution_ssh/log_filter.rb
|
177
|
+
- lib/smart_proxy_remote_execution_ssh/net_ssh_compat.rb
|
174
178
|
- lib/smart_proxy_remote_execution_ssh/plugin.rb
|
175
179
|
- lib/smart_proxy_remote_execution_ssh/runners.rb
|
176
180
|
- lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb
|
177
181
|
- lib/smart_proxy_remote_execution_ssh/runners/polling_script_runner.rb
|
178
182
|
- lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb
|
183
|
+
- lib/smart_proxy_remote_execution_ssh/utils.rb
|
179
184
|
- lib/smart_proxy_remote_execution_ssh/version.rb
|
180
185
|
- lib/smart_proxy_remote_execution_ssh/webrick_ext.rb
|
181
186
|
- settings.d/remote_execution_ssh.yml.example
|