foreman_salt 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_salt/states.js +1 -1
- data/app/controllers/foreman_salt/minions_controller.rb +1 -1
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +3 -4
- data/app/models/foreman_salt/concerns/hostgroup_extensions.rb +2 -10
- data/lib/foreman_salt/version.rb +1 -1
- data/test/factories/foreman_salt_factories.rb +5 -4
- data/test/unit/hostgroup_extensions_test.rb +19 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea1caeb04b5f73dc724c2d4bdd45e46055dbf80
|
4
|
+
data.tar.gz: 21b7646d6d05aea5c7a393e1505910bc08efde11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae9d028461860b4fac00233e19a8de3b74614c92278539d4848649c20fc632987f1cd1f33aa53c3d63c8de9e7831532e0f753f49317fe0147f1c9de2c8e1e3c
|
7
|
+
data.tar.gz: 495c4414f5718ecc4d75ba82bada937b1cf799327f9adebe434a65ead4880eb45c4f79fc2717e5e66357691617e25809e6566409ba67375c9320d704aed0fea2
|
@@ -4,7 +4,7 @@ $(document).on( "ContentLoad", function() {
|
|
4
4
|
|
5
5
|
function update_salt_states(element) {
|
6
6
|
var host_id = $("form").data('id')
|
7
|
-
var env_id = $('
|
7
|
+
var env_id = $('select[name*=salt_environment_id]').val();
|
8
8
|
var url = $(element).attr('data-url');
|
9
9
|
var data = $("form").serialize().replace('method=put', 'method=post');
|
10
10
|
|
@@ -69,7 +69,7 @@ module ForemanSalt
|
|
69
69
|
@minion = Host::Base.authorized(:view_hosts, Host).find_by_id(params[:host_id])
|
70
70
|
if @minion
|
71
71
|
unless @minion.is_a?(Host::Managed)
|
72
|
-
@minion = @
|
72
|
+
@minion = @minion.becomes(Host::Managed)
|
73
73
|
@minion.type = 'Host::Managed'
|
74
74
|
end
|
75
75
|
@minion.attributes = params[:host]
|
@@ -33,10 +33,9 @@ module ForemanSalt
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def salt_modules_for_enc
|
36
|
-
return [] unless
|
37
|
-
|
38
|
-
|
39
|
-
self.salt_environment.salt_modules.where(:id => self.salt_modules + hostgroup_modules).pluck(:name)
|
36
|
+
return [] unless salt_environment
|
37
|
+
modules = salt_modules + (hostgroup ? hostgroup.all_salt_modules : [])
|
38
|
+
ForemanSalt::SaltModule.in_environment(salt_environment).where(:id => modules).pluck(:name).uniq
|
40
39
|
end
|
41
40
|
|
42
41
|
def salt_master
|
@@ -16,11 +16,7 @@ module ForemanSalt
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def all_salt_modules
|
19
|
-
|
20
|
-
(self.salt_modules + self.inherited_salt_modules).uniq
|
21
|
-
else
|
22
|
-
self.salt_modules
|
23
|
-
end
|
19
|
+
ForemanSalt::SaltModule.in_environment(salt_environment).where(:id => salt_module_ids + inherited_salt_module_ids)
|
24
20
|
end
|
25
21
|
|
26
22
|
def inherited_salt_modules
|
@@ -28,11 +24,7 @@ module ForemanSalt
|
|
28
24
|
end
|
29
25
|
|
30
26
|
def inherited_salt_module_ids
|
31
|
-
|
32
|
-
self.class.sort_by_ancestry(ancestors.reject { |ancestor| ancestor.salt_module_ids.empty? }).map(&:salt_module_ids).inject(&:+).uniq
|
33
|
-
else
|
34
|
-
[]
|
35
|
-
end
|
27
|
+
ancestors.map(&:salt_module_ids).flatten.uniq
|
36
28
|
end
|
37
29
|
|
38
30
|
def salt_proxy
|
data/lib/foreman_salt/version.rb
CHANGED
@@ -4,24 +4,25 @@ FactoryGirl.define do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
factory :salt_environment, :class => 'ForemanSalt::SaltEnvironment' do
|
7
|
-
sequence(:name) { |n| "
|
7
|
+
sequence(:name) { |n| "environment#{n}" }
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
FactoryGirl.modify do
|
12
12
|
factory :host do
|
13
13
|
trait :with_salt_proxy do
|
14
|
-
salt_proxy { FactoryGirl.
|
14
|
+
salt_proxy { FactoryGirl.build :smart_proxy, :with_salt_feature }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
factory :hostgroup do
|
19
19
|
trait :with_salt_proxy do
|
20
|
-
salt_proxy { FactoryGirl.
|
20
|
+
salt_proxy { FactoryGirl.build :smart_proxy, :with_salt_feature }
|
21
21
|
end
|
22
22
|
|
23
23
|
trait :with_salt_modules do
|
24
|
-
|
24
|
+
salt_environment { FactoryGirl.build :salt_environment }
|
25
|
+
salt_modules { FactoryGirl.create_list :salt_module, 10, :salt_environments => [self.salt_environment] }
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -25,16 +25,32 @@ module ForemanSalt
|
|
25
25
|
end
|
26
26
|
|
27
27
|
test 'child and parent salt modules are combined' do
|
28
|
+
environment = FactoryGirl.create :salt_environment
|
29
|
+
parent = FactoryGirl.create :hostgroup, :with_salt_modules, :salt_environment => environment
|
30
|
+
child = FactoryGirl.create :hostgroup, :with_salt_modules, :salt_environment => environment, :parent => parent
|
31
|
+
|
32
|
+
total = parent.salt_modules.count + child.salt_modules.count
|
33
|
+
assert_equal total, child.all_salt_modules.count
|
34
|
+
end
|
35
|
+
|
36
|
+
test 'child doesnt get modules from outside its environment' do
|
28
37
|
parent = FactoryGirl.create :hostgroup, :with_salt_modules
|
29
38
|
child = FactoryGirl.create :hostgroup, :with_salt_modules, :parent => parent
|
30
|
-
assert_equal
|
39
|
+
assert_equal child.salt_modules.count, child.all_salt_modules.count
|
31
40
|
end
|
32
41
|
|
33
|
-
test '
|
42
|
+
test 'inheritance when only parent has modules' do
|
34
43
|
parent = FactoryGirl.create :hostgroup, :with_salt_modules
|
35
44
|
child_one = FactoryGirl.create :hostgroup, :parent => parent
|
36
45
|
child_two = FactoryGirl.create :hostgroup, :parent => child_one
|
37
|
-
|
46
|
+
assert_blank parent.all_salt_modules - child_two.all_salt_modules
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'inheritance when no parents have modules' do
|
50
|
+
parent = FactoryGirl.create :hostgroup
|
51
|
+
child_one = FactoryGirl.create :hostgroup, :parent => parent
|
52
|
+
child_two = FactoryGirl.create :hostgroup, :with_salt_modules, :parent => child_one
|
53
|
+
assert child_two.all_salt_modules.any?
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
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: 3.0.
|
4
|
+
version: 3.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: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: foreman-tasks
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|