smart_proxy_salt 5.0.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/foreman-node +6 -3
- data/lib/smart_proxy_salt/cli.rb +5 -7
- data/lib/smart_proxy_salt/rest.rb +1 -0
- data/lib/smart_proxy_salt/salt.rb +5 -5
- data/lib/smart_proxy_salt/salt_runner.rb +2 -0
- data/lib/smart_proxy_salt/salt_task_launcher.rb +2 -0
- data/lib/smart_proxy_salt/version.rb +1 -1
- data/sbin/upload-salt-reports +1 -1
- metadata +13 -91
- data/bin/salt_python_wrapper +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea43480d38aa6f8d3694e61899d0b5dadeacaacc775a82d8ab2a456810bb8bcd
|
4
|
+
data.tar.gz: 6101554d6bf03679d29399f4ad92fbc51c4bfe1250e928433eca682ad015bac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de7cddee069d666c6cc4a7400c2df16d647c4e244286a0376e8c1416555c85e1d295975017b28041305be31e2cbe02343c9da5e9688c8666b8141c0d1a8fbb1
|
7
|
+
data.tar.gz: 30464b1b58712d5a022c49b4e104fe29e5b82ad44d356cd50d59fb3b54dca0ce6b8fc7ead55e93f6ecf193c24a04782a924fbc650129c570b4606bf04f5b4408
|
data/bin/foreman-node
CHANGED
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
def get_grains(minion)
|
47
47
|
grains = {
|
48
|
-
:name
|
48
|
+
:name => minion,
|
49
49
|
:facts => plain_grains(minion).merge(:_timestamp => Time.now, :_type => 'foreman_salt')
|
50
50
|
}
|
51
51
|
|
@@ -94,9 +94,10 @@ end
|
|
94
94
|
def plainify(hash, prefix = nil)
|
95
95
|
result = []
|
96
96
|
hash.each_pair do |key, value|
|
97
|
-
|
97
|
+
case value
|
98
|
+
when Hash
|
98
99
|
result.push plainify(value, get_key(key, prefix))
|
99
|
-
|
100
|
+
when Array
|
100
101
|
result.push plainify(array_to_hash(value), get_key(key, prefix))
|
101
102
|
else
|
102
103
|
new = {}
|
@@ -169,12 +170,14 @@ def enc(minion)
|
|
169
170
|
res = http.start { |conn| conn.request(req) }
|
170
171
|
|
171
172
|
raise "Error retrieving node #{minion}: #{res.class}\nCheck Foreman's /var/log/foreman/production.log for more information." unless res.code == '200'
|
173
|
+
|
172
174
|
res.body
|
173
175
|
end
|
174
176
|
|
175
177
|
minion = ARGV[0] || raise('Must provide minion as an argument')
|
176
178
|
|
177
179
|
raise 'Invalid hostname' unless valid_hostname? minion
|
180
|
+
|
178
181
|
begin
|
179
182
|
result = ''
|
180
183
|
|
data/lib/smart_proxy_salt/cli.rb
CHANGED
@@ -56,16 +56,15 @@ module Proxy
|
|
56
56
|
|
57
57
|
def autosign_list
|
58
58
|
return [] unless File.exist?(autosign_file)
|
59
|
+
|
59
60
|
File.read(autosign_file).split("\n").reject do |v|
|
60
61
|
v =~ /^\s*#.*|^$/ ## Remove comments and empty lines
|
61
62
|
end.map(&:chomp)
|
62
63
|
end
|
63
64
|
|
64
65
|
def append_value_to_file(filepath, value)
|
65
|
-
File.open(filepath, File::CREAT|File::RDWR) do |file|
|
66
|
-
unless file.any? { |line| line.chomp == value}
|
67
|
-
file.puts value
|
68
|
-
end
|
66
|
+
File.open(filepath, File::CREAT | File::RDWR) do |file|
|
67
|
+
file.puts value unless file.any? { |line| line.chomp == value }
|
69
68
|
end
|
70
69
|
logger.info "Added an entry to '#{filepath}' successfully."
|
71
70
|
true
|
@@ -75,7 +74,6 @@ module Proxy
|
|
75
74
|
end
|
76
75
|
|
77
76
|
def remove_value_from_file(filepath, value)
|
78
|
-
|
79
77
|
return true unless File.exist?(filepath)
|
80
78
|
|
81
79
|
found = false
|
@@ -84,14 +82,14 @@ module Proxy
|
|
84
82
|
if entry == value
|
85
83
|
found = true
|
86
84
|
nil
|
87
|
-
elsif entry ==
|
85
|
+
elsif entry == ''
|
88
86
|
nil
|
89
87
|
else
|
90
88
|
line
|
91
89
|
end
|
92
90
|
end.uniq.compact
|
93
91
|
if found
|
94
|
-
File.write(filepath, entries.join
|
92
|
+
File.write(filepath, entries.join)
|
95
93
|
logger.info "Removed an entry from '#{filepath}' successfully."
|
96
94
|
end
|
97
95
|
true
|
@@ -12,11 +12,11 @@ module Proxy
|
|
12
12
|
class Plugin < ::Proxy::Plugin
|
13
13
|
plugin 'salt', Proxy::Salt::VERSION
|
14
14
|
|
15
|
-
default_settings :autosign_file
|
16
|
-
:autosign_key_file
|
17
|
-
:salt_command_user
|
18
|
-
:use_api
|
19
|
-
:saltfile
|
15
|
+
default_settings :autosign_file => '/etc/salt/autosign.conf',
|
16
|
+
:autosign_key_file => '/var/lib/foreman-proxy/salt/grains/autosign_key',
|
17
|
+
:salt_command_user => 'root',
|
18
|
+
:use_api => false,
|
19
|
+
:saltfile => '/etc/foreman-proxy/settings.d/salt.saltfile'
|
20
20
|
|
21
21
|
requires :dynflow, '>= 0.5.0'
|
22
22
|
|
data/sbin/upload-salt-reports
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Moll
|
@@ -9,96 +9,15 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '2'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '2'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: mocha
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: webmock
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '1'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '1'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rake
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '13'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '13'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rubocop
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - '='
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 0.50.0
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - '='
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 0.50.0
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rack-test
|
15
|
+
name: smart_proxy_dynflow
|
86
16
|
requirement: !ruby/object:Gem::Requirement
|
87
17
|
requirements:
|
88
18
|
- - "~>"
|
89
19
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: smart_proxy_dynflow
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
20
|
+
version: '0.5'
|
102
21
|
- - ">="
|
103
22
|
- !ruby/object:Gem::Version
|
104
23
|
version: 0.5.0
|
@@ -106,14 +25,16 @@ dependencies:
|
|
106
25
|
prerelease: false
|
107
26
|
version_requirements: !ruby/object:Gem::Requirement
|
108
27
|
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0.5'
|
109
31
|
- - ">="
|
110
32
|
- !ruby/object:Gem::Version
|
111
33
|
version: 0.5.0
|
112
|
-
description:
|
34
|
+
description: This plug-in adds support for Salt to Foreman's Smart Proxy
|
113
35
|
email: foreman-dev@googlegroups.com
|
114
36
|
executables:
|
115
37
|
- foreman-node
|
116
|
-
- salt_python_wrapper
|
117
38
|
extensions: []
|
118
39
|
extra_rdoc_files:
|
119
40
|
- README.md
|
@@ -122,7 +43,6 @@ files:
|
|
122
43
|
- LICENSE
|
123
44
|
- README.md
|
124
45
|
- bin/foreman-node
|
125
|
-
- bin/salt_python_wrapper
|
126
46
|
- bundler.d/salt.rb
|
127
47
|
- etc/foreman.conf.example
|
128
48
|
- etc/foreman.yaml.example
|
@@ -160,15 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
80
|
requirements:
|
161
81
|
- - ">="
|
162
82
|
- !ruby/object:Gem::Version
|
163
|
-
version: '
|
83
|
+
version: '2.7'
|
84
|
+
- - "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '4'
|
164
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
88
|
requirements:
|
166
89
|
- - ">="
|
167
90
|
- !ruby/object:Gem::Version
|
168
91
|
version: '0'
|
169
92
|
requirements: []
|
170
|
-
|
171
|
-
rubygems_version: 2.7.6
|
93
|
+
rubygems_version: 3.3.26
|
172
94
|
signing_key:
|
173
95
|
specification_version: 4
|
174
96
|
summary: SaltStack Plug-In for Foreman's Smart Proxy
|
data/bin/salt_python_wrapper
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
set -u
|
4
|
-
|
5
|
-
for py in 'python3' 'python'; do
|
6
|
-
exe=$(type -p ${py})
|
7
|
-
if [ -n "${exe}" ]; then
|
8
|
-
if ${exe} -c 'import salt.config'; then
|
9
|
-
${exe} "$@"
|
10
|
-
exit $?
|
11
|
-
fi
|
12
|
-
fi
|
13
|
-
done
|
14
|
-
|
15
|
-
echo "No usable python version found, check if python or python3 can import salt.config!" 1>&2
|
16
|
-
exit 1
|