smart_proxy_openbolt 0.1.1 → 1.2.0
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 +4 -4
- data/README.md +297 -11
- data/lib/smart_proxy_openbolt/api.rb +20 -41
- data/lib/smart_proxy_openbolt/config/choria-client.conf +25 -0
- data/lib/smart_proxy_openbolt/error.rb +17 -27
- data/lib/smart_proxy_openbolt/executor.rb +32 -26
- data/lib/smart_proxy_openbolt/job.rb +17 -81
- data/lib/smart_proxy_openbolt/lru_cache.rb +43 -0
- data/lib/smart_proxy_openbolt/main.rb +293 -106
- data/lib/smart_proxy_openbolt/plugin.rb +7 -9
- data/lib/smart_proxy_openbolt/result.rb +20 -23
- data/lib/smart_proxy_openbolt/task_job.rb +36 -41
- data/lib/smart_proxy_openbolt/version.rb +1 -1
- data/settings.d/openbolt.yml +1 -0
- metadata +6 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require 'smart_proxy_openbolt/error'
|
|
3
3
|
require 'smart_proxy_openbolt/job'
|
|
4
|
-
require 'smart_proxy_openbolt/main'
|
|
5
4
|
require 'smart_proxy_openbolt/result'
|
|
6
5
|
|
|
7
6
|
module Proxy::OpenBolt
|
|
@@ -16,58 +15,54 @@ module Proxy::OpenBolt
|
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def execute
|
|
19
|
-
command =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
command = ['bolt', 'task', 'run', @name,
|
|
19
|
+
'--targets', @targets.join(','),
|
|
20
|
+
'--no-save-rerun',
|
|
21
|
+
"--concurrency=#{Plugin.settings.concurrency}",
|
|
22
|
+
"--connect-timeout=#{Plugin.settings.connect_timeout}",
|
|
23
|
+
'--project', Plugin.settings.environment_path,
|
|
24
|
+
'--format', 'json',
|
|
25
|
+
'--no-color']
|
|
26
|
+
command.concat(parse_options)
|
|
27
|
+
command.concat(parse_parameters)
|
|
28
|
+
stdout, stderr, exitcode = Proxy::OpenBolt.openbolt(command)
|
|
29
|
+
Result.new(
|
|
30
|
+
Proxy::OpenBolt.scrub(@options, command.join(' ')),
|
|
23
31
|
Proxy::OpenBolt.scrub(@options, stdout),
|
|
24
32
|
Proxy::OpenBolt.scrub(@options, stderr),
|
|
25
|
-
|
|
33
|
+
exitcode
|
|
26
34
|
)
|
|
27
35
|
end
|
|
28
36
|
|
|
29
|
-
def get_cmd
|
|
30
|
-
# Service config settings (not per-task)
|
|
31
|
-
concurrency = "--concurrency=#{Proxy::OpenBolt::Plugin.settings.concurrency}"
|
|
32
|
-
connect_timeout = "--connect-timeout=#{Proxy::OpenBolt::Plugin.settings.connect_timeout}"
|
|
33
|
-
"bolt task run #{@name} --targets #{@targets.join(',')} --no-save-rerun #{concurrency} #{connect_timeout} --project #{Proxy::OpenBolt::Plugin.settings.environment_path} --format json --no-color #{parse_options} #{parse_parameters}"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
37
|
def parse_parameters
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
params << "#{key}='#{value}'"
|
|
41
|
-
elsif value.is_a?(Hash)
|
|
42
|
-
params << "#{key}='#{value.to_json}'"
|
|
43
|
-
else
|
|
44
|
-
params << "#{key}=#{value}"
|
|
45
|
-
end
|
|
38
|
+
@parameters.map do |key, value|
|
|
39
|
+
formatted = value.is_a?(Array) || value.is_a?(Hash) ? value.to_json : value
|
|
40
|
+
"#{key}=#{formatted}"
|
|
46
41
|
end
|
|
47
|
-
params.join(' ')
|
|
48
42
|
end
|
|
49
43
|
|
|
50
44
|
def parse_options
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
45
|
+
opts = []
|
|
46
|
+
return opts unless @options
|
|
47
|
+
|
|
48
|
+
@options.each do |key, value|
|
|
49
|
+
# --noop doesn't have a --[no-] prefix
|
|
50
|
+
next if key == 'noop' && value.is_a?(FalseClass)
|
|
51
|
+
# For some mindboggling reason, there are both '--log-level trace'
|
|
52
|
+
# and '--trace' options. We only expose log level, so just
|
|
53
|
+
# tack on --trace if that's what we find.
|
|
54
|
+
if key == 'log-level' && value == 'trace'
|
|
55
|
+
opts << '--log-level=trace'
|
|
56
|
+
opts << '--trace'
|
|
57
|
+
elsif value.is_a?(TrueClass)
|
|
58
|
+
opts << "--#{key}"
|
|
59
|
+
elsif value.is_a?(FalseClass)
|
|
60
|
+
opts << "--no-#{key}"
|
|
61
|
+
else
|
|
62
|
+
opts << "--#{key}=#{value}"
|
|
68
63
|
end
|
|
69
64
|
end
|
|
70
|
-
|
|
65
|
+
opts
|
|
71
66
|
end
|
|
72
67
|
end
|
|
73
68
|
end
|
data/settings.d/openbolt.yml
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smart_proxy_openbolt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Overlook InfraTech
|
|
@@ -42,10 +42,12 @@ files:
|
|
|
42
42
|
- bundler.d/openbolt.rb
|
|
43
43
|
- lib/smart_proxy_openbolt.rb
|
|
44
44
|
- lib/smart_proxy_openbolt/api.rb
|
|
45
|
+
- lib/smart_proxy_openbolt/config/choria-client.conf
|
|
45
46
|
- lib/smart_proxy_openbolt/error.rb
|
|
46
47
|
- lib/smart_proxy_openbolt/executor.rb
|
|
47
48
|
- lib/smart_proxy_openbolt/http_config.ru
|
|
48
49
|
- lib/smart_proxy_openbolt/job.rb
|
|
50
|
+
- lib/smart_proxy_openbolt/lru_cache.rb
|
|
49
51
|
- lib/smart_proxy_openbolt/main.rb
|
|
50
52
|
- lib/smart_proxy_openbolt/plugin.rb
|
|
51
53
|
- lib/smart_proxy_openbolt/result.rb
|
|
@@ -55,7 +57,8 @@ files:
|
|
|
55
57
|
homepage: http://github.com/overlookinfra/smart_proxy_openbolt
|
|
56
58
|
licenses:
|
|
57
59
|
- GPL-3.0-only
|
|
58
|
-
metadata:
|
|
60
|
+
metadata:
|
|
61
|
+
rubygems_mfa_required: 'true'
|
|
59
62
|
rdoc_options: []
|
|
60
63
|
require_paths:
|
|
61
64
|
- lib
|
|
@@ -70,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
70
73
|
- !ruby/object:Gem::Version
|
|
71
74
|
version: '0'
|
|
72
75
|
requirements: []
|
|
73
|
-
rubygems_version:
|
|
76
|
+
rubygems_version: 4.0.6
|
|
74
77
|
specification_version: 4
|
|
75
78
|
summary: Smart Proxy plugin for OpenBolt integration
|
|
76
79
|
test_files: []
|