foreman_salt 17.0.0 → 17.0.1
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: 844fdd7edf134c6be722188275d2443e62c1c2735d74670741d953252f41d311
|
4
|
+
data.tar.gz: 83517fb9cd563e61f14dacf0bb7e106c83ba558d13ada6233f00f33363caea81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d930a25245ce6dadeb3abb9b17bd61c884ea9f020f66b2fa837f50b960ae034f2dd4e2a24bb8f90a1c0994897746811fb291b819125a062208c1d8e5210b01
|
7
|
+
data.tar.gz: '092feadf358cdfa2007310c4f95c9c571fe7524eb633e856b81b168e5c16f25f4155ca11a2114e3212a7a71af199ce2ac1e808a9824c036f02cb640c26f3a7f4'
|
@@ -42,8 +42,8 @@ module ForemanSalt
|
|
42
42
|
|
43
43
|
validate :salt_modules_in_host_environment
|
44
44
|
|
45
|
-
|
46
|
-
before_destroy :
|
45
|
+
after_validation :queue_ensure_salt_autosign, if: ->(host) { host.salt_proxy }
|
46
|
+
before_destroy :queue_remove_salt_minion, if: ->(host) { host.salt_proxy }
|
47
47
|
end
|
48
48
|
|
49
49
|
def salt_params
|
@@ -107,10 +107,32 @@ module ForemanSalt
|
|
107
107
|
|
108
108
|
private
|
109
109
|
|
110
|
+
def queue_ensure_salt_autosign
|
111
|
+
return unless new_record? || build_changed?
|
112
|
+
|
113
|
+
generate_salt_autosign_key
|
114
|
+
queue.create(id: "ensure_salt_autosign_#{id}", name: _('Configure Salt Autosign key for %s') % self,
|
115
|
+
priority: 101, action: [self, :ensure_salt_autosign])
|
116
|
+
end
|
117
|
+
|
118
|
+
def queue_remove_salt_minion
|
119
|
+
queue.create(id: "queue_remove_salt_minion_#{id}", name: _('Remove Salt Minion for %s') % self,
|
120
|
+
priority: 101, action: [self, :remove_salt_minion])
|
121
|
+
end
|
122
|
+
|
123
|
+
def generate_salt_autosign_key
|
124
|
+
if salt_autosign_key.nil?
|
125
|
+
Rails.logger.info("Generate salt autosign key for #{fqdn}")
|
126
|
+
self.salt_autosign_key = generate_provisioning_key
|
127
|
+
else
|
128
|
+
Rails.logger.info("Use existing salt autosign key for #{fqdn}")
|
129
|
+
end
|
130
|
+
self.salt_status = ForemanSalt::SaltStatus.minion_auth_waiting
|
131
|
+
end
|
132
|
+
|
110
133
|
def ensure_salt_autosign
|
111
134
|
remove_salt_key
|
112
|
-
|
113
|
-
create_salt_autosign
|
135
|
+
configure_salt_autosign
|
114
136
|
end
|
115
137
|
|
116
138
|
def remove_salt_minion
|
@@ -140,13 +162,11 @@ module ForemanSalt
|
|
140
162
|
SecureRandom.hex(10)
|
141
163
|
end
|
142
164
|
|
143
|
-
def
|
144
|
-
Rails.logger.info("
|
165
|
+
def configure_salt_autosign
|
166
|
+
Rails.logger.info("Configure salt autosign key for host #{fqdn} on #{salt_proxy.url}")
|
145
167
|
api = ProxyAPI::Salt.new(url: salt_proxy.url)
|
146
|
-
key =
|
168
|
+
key = salt_autosign_key
|
147
169
|
api.autosign_create_key(key)
|
148
|
-
update(salt_autosign_key: key)
|
149
|
-
update(salt_status: ForemanSalt::SaltStatus.minion_auth_waiting)
|
150
170
|
rescue Foreman::Exception => e
|
151
171
|
Rails.logger.warn("Unable to create salt autosign for #{fqdn}: #{e}")
|
152
172
|
end
|
data/lib/foreman_salt/version.rb
CHANGED
@@ -18,7 +18,7 @@ module ForemanSalt
|
|
18
18
|
|
19
19
|
assert_new_button(salt_variables_path, 'New Salt Variable', new_salt_variable_path)
|
20
20
|
fill_in 'foreman_salt_salt_variable_key', with: 'mykey'
|
21
|
-
|
21
|
+
select(state.name, from: 'foreman_salt_salt_variable_salt_module_id')
|
22
22
|
|
23
23
|
assert_submit_button(salt_variables_path)
|
24
24
|
assert page.has_link? 'mykey'
|
@@ -64,7 +64,7 @@ module ForemanSalt
|
|
64
64
|
|
65
65
|
context 'autosign handling' do
|
66
66
|
before do
|
67
|
-
@host = FactoryBot.create(:host, :
|
67
|
+
@host = FactoryBot.create(:host, salt_autosign_key: 'asdfasdfasfasdf')
|
68
68
|
@host.salt_proxy = @proxy
|
69
69
|
stub_request(:post, "#{@proxy.url}/salt/autosign_key/asdfasdfasfasdf")
|
70
70
|
.to_return(status: 200, body: '', headers: {})
|
@@ -72,10 +72,9 @@ module ForemanSalt
|
|
72
72
|
.to_return(status: 200, body: '', headers: {})
|
73
73
|
end
|
74
74
|
|
75
|
-
test 'host autosign is created
|
75
|
+
test 'host autosign is created before host is provisioned' do
|
76
76
|
autosign_key = 'asdfasdfasfasdf'
|
77
|
-
@host.
|
78
|
-
@host.build = true
|
77
|
+
@host.build = false
|
79
78
|
|
80
79
|
assert @host.save!
|
81
80
|
@host.clear_host_parameters_cache!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 17.0.
|
4
|
+
version: 17.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Benjamin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '14.0'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '16'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '14.0'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '16'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: foreman-tasks
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
|
-
rubygems_version: 3.
|
288
|
+
rubygems_version: 3.3.27
|
289
289
|
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Foreman Plug-in for Salt
|