foreman_puppet 11.2.1 → 11.3.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79831ddc74b8dd19b92504b30672177d03a555fe0706de935b66bbc8346f1e81
|
|
4
|
+
data.tar.gz: c32242bb3a5a5f796976755ccce35bc4a1a8bdbfc77c6f6534e984d8b68580e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 295d5d3cab2df086b6bf756a43215cc0b8369b3fd954cc89f690a26911ff357846ad0d8cfe2b1916ee629abe118a12cf55b4d35c0bcf0a26decd59d96eb11c01
|
|
7
|
+
data.tar.gz: 1667f24cf88f09b8eaf28873dec051813ff3d1862a389ed64dbf19d9639f2d5c97ef08d8a23e256abf9118041a87ca44f4e588d5abe6a0f45e08626d6c262bd2
|
|
@@ -34,7 +34,8 @@ module ForemanPuppet
|
|
|
34
34
|
def completer_scope(field)
|
|
35
35
|
return super unless ASSIGNMENT_RELATIONS.include?(field.relation)
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
options = @options.merge(autocomplete_resource: definition.klass)
|
|
38
|
+
field.klass.completer_scope(options).reorder(Arel.sql(field.quoted_field))
|
|
38
39
|
end
|
|
39
40
|
end
|
|
40
41
|
|
|
@@ -62,6 +62,24 @@ module ForemanPuppet
|
|
|
62
62
|
where(id: direct).or(where(id: via_hostgroup)).or(where(id: via_config_group))
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
scope :assigned_to_hostgroups, lambda {
|
|
66
|
+
hostgroup_facets = ForemanPuppet::HostgroupPuppetFacet
|
|
67
|
+
.where(hostgroup_id: ::Hostgroup.unscoped.with_taxonomy_scope.reorder(nil).select(:id))
|
|
68
|
+
.select(:id)
|
|
69
|
+
direct = ForemanPuppet::HostgroupClass
|
|
70
|
+
.where(hostgroup_puppet_facet_id: hostgroup_facets)
|
|
71
|
+
.select(:puppetclass_id)
|
|
72
|
+
config_groups = ForemanPuppet::HostConfigGroup
|
|
73
|
+
.where(
|
|
74
|
+
host_type: ForemanPuppet::HostgroupPuppetFacet.polymorphic_name,
|
|
75
|
+
host_id: hostgroup_facets
|
|
76
|
+
)
|
|
77
|
+
.select(:config_group_id)
|
|
78
|
+
via_config_group = ForemanPuppet::ConfigGroupClass.where(config_group_id: config_groups).select(:puppetclass_id)
|
|
79
|
+
|
|
80
|
+
where(id: direct).or(where(id: via_config_group))
|
|
81
|
+
}
|
|
82
|
+
|
|
65
83
|
scoped_search on: :name, complete_value: true
|
|
66
84
|
scoped_search relation: :environments, on: :name, complete_value: true, rename: 'environment'
|
|
67
85
|
scoped_search relation: :organizations, on: :name, complete_value: true, rename: 'organization', only_explicit: true
|
|
@@ -165,7 +183,8 @@ module ForemanPuppet
|
|
|
165
183
|
end
|
|
166
184
|
|
|
167
185
|
def self.completer_scope(options)
|
|
168
|
-
|
|
186
|
+
assignment_scope = options[:autocomplete_resource] == ::Hostgroup ? assigned_to_hostgroups : assigned_to_hosts
|
|
187
|
+
super.merge(assignment_scope)
|
|
169
188
|
end
|
|
170
189
|
end
|
|
171
190
|
end
|
|
@@ -97,6 +97,23 @@ module ForemanPuppet
|
|
|
97
97
|
assert_not_includes hidden_config_groups, %(config_group = "#{hidden_config_group.name}")
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
+
test 'can complete Puppet class values assigned through a config group' do
|
|
101
|
+
config_group = hostgroup.puppet.config_groups.first
|
|
102
|
+
puppetclass = FactoryBot.create(:puppetclass)
|
|
103
|
+
config_group.puppetclasses << puppetclass
|
|
104
|
+
completions = ::Hostgroup.complete_for("puppetclass = #{puppetclass.name}")
|
|
105
|
+
|
|
106
|
+
assert_includes completions, %(puppetclass = "#{puppetclass.name}")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
test 'does not complete Puppet class values assigned only to hosts' do
|
|
110
|
+
host = FactoryBot.create(:host, :with_puppet_enc, :with_puppetclass)
|
|
111
|
+
puppetclass = host.puppet.puppetclasses.first
|
|
112
|
+
completions = ::Hostgroup.complete_for("puppetclass = #{puppetclass.name}")
|
|
113
|
+
|
|
114
|
+
assert_not_includes completions, %(puppetclass = "#{puppetclass.name}")
|
|
115
|
+
end
|
|
116
|
+
|
|
100
117
|
test 'searches Puppet class values assigned through a config group' do
|
|
101
118
|
config_group = hostgroup.puppet.config_groups.first
|
|
102
119
|
puppetclass = FactoryBot.create(:puppetclass)
|