Skip to content

Commit 47c0f24

Browse files
committed
Expand GH-130 merge pattern to all node groups
At least for the configuration data attribute. A long-term solution is going to need to be modifying WhatsARanjit/node_manager to support a `purge` parameter to control this behavior on various different attributes.
1 parent 563eb2e commit 47c0f24

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Diff for: lib/puppet/functions/peadm/merge_ng_config_data.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def merge_ng_config_data(group_name, new_config_data)
2424

2525
ng = Puppet::Util::Nc_https.new
2626
group = ng.get_groups.select { |g| g['name'] == group_name }.first
27-
group['config_data'].deep_merge(new_config_data)
27+
data = group ? group['config_data'] : {}
28+
data.deep_merge(new_config_data)
2829
rescue StandardError => e
2930
Puppet.warn "Error attempting to read and merge node_group config data for #{group_name}: #{e.message}"
3031
new_config_data

Diff for: manifests/setup/node_manager.pp

+8-8
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@
9595
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/master'],
9696
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'A'],
9797
],
98-
data => {
98+
data => Deferred('peadm::merge_ng_config_data', ['PE Master A', {
9999
'puppet_enterprise::profile::primary_master_replica' => {
100100
'database_host_puppetdb' => $puppetdb_database_host,
101101
},
102102
'puppet_enterprise::profile::puppetdb' => {
103103
'database_host' => $puppetdb_database_host,
104104
},
105-
},
105+
}]),
106106
}
107107

108108
# Configure the A pool for compilers. There are up to two pools for HA, each
@@ -123,12 +123,12 @@
123123
'puppetdb_port' => [8081],
124124
}
125125
},
126-
data => {
126+
data => Deferred('peadm::merge_ng_config_data', ['PE Compiler Group A', {
127127
# Workaround for GH-118
128128
'puppet_enterprise::profile::master::puppetdb' => {
129129
'ha_enabled_replicas' => [ ],
130130
},
131-
},
131+
}]),
132132
}
133133

134134
# Create the replica and B groups if a replica master and database host are
@@ -154,14 +154,14 @@
154154
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/master'],
155155
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'B'],
156156
],
157-
data => {
157+
data => Deferred('peadm::merge_ng_config_data', ['PE Master B', {
158158
'puppet_enterprise::profile::primary_master_replica' => {
159159
'database_host_puppetdb' => $puppetdb_database_replica_host,
160160
},
161161
'puppet_enterprise::profile::puppetdb' => {
162162
'database_host' => $puppetdb_database_replica_host,
163163
},
164-
},
164+
}]),
165165
}
166166

167167
node_group { 'PE Compiler Group B':
@@ -180,12 +180,12 @@
180180
'puppetdb_port' => [8081],
181181
}
182182
},
183-
data => {
183+
data => Deferred('peadm::merge_ng_config_data', ['PE Compiler Group B', {
184184
# Workaround for GH-118
185185
'puppet_enterprise::profile::master::puppetdb' => {
186186
'ha_enabled_replicas' => [ ],
187187
},
188-
},
188+
}]),
189189
}
190190
}
191191

0 commit comments

Comments
 (0)