Skip to content

Commit 7d0e0c3

Browse files
committed
Use custom OIDs for peadm role and avil. group
Previously, peadm used pp_application and pp_cluster for this purpose. This conflicted with some existing customer's usage of those attributes. In order to avoid collision with customer OID usage, this commit modifies peadm to use custom OIDs.
1 parent 320b60e commit 7d0e0c3

File tree

4 files changed

+34
-27
lines changed

4 files changed

+34
-27
lines changed

functions/oid.pp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function peadm::oid (
2+
String $short_name,
3+
) {
4+
case $short_name {
5+
'peadm_role': { '1.3.6.1.4.1.34380.1.1.9812' }
6+
'peadm_availability_group': { '1.3.6.1.4.1.34380.1.1.9813' }
7+
default: { fail("No peadm OID for ${short_name}") }
8+
}
9+
}

manifests/setup/node_manager.pp

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# This profile is not intended to be continously enforced on PE masters.
22
# Rather, it describes state to enforce as a boostrap action, preparing the
33
# Puppet Enterprise console with a sane default environment configuration.
4-
# Importantly, this includes assigning nodes to an environment matching thier
5-
# trusted.extensions.pp_environment value by default.
64
#
75
# This class will be applied during master bootstrap using e.g.
86
#
@@ -49,7 +47,7 @@
4947
# We modify this group's rule such that all PE infrastructure nodes will be
5048
# members.
5149
node_group { 'PE Infrastructure Agent':
52-
rule => ['and', ['~', ['trusted', 'extensions', 'pp_application'], '^puppet/']],
50+
rule => ['and', ['~', ['trusted', 'extensions', peadm::oid('peadm_role')], '^puppet/']],
5351
}
5452

5553
# We modify this group to add, as data, the compiler_pool_address only.
@@ -58,7 +56,7 @@
5856
node_group { 'PE Master':
5957
parent => 'PE Infrastructure',
6058
rule => ['or',
61-
['and', ['=', ['trusted', 'extensions', 'pp_application'], 'puppet/compiler']],
59+
['and', ['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/compiler']],
6260
['=', 'name', $master_host],
6361
],
6462
data => {
@@ -77,7 +75,7 @@
7775
parent => 'PE Infrastructure',
7876
environment => 'production',
7977
override_environment => false,
80-
rule => ['and', ['=', ['trusted', 'extensions', 'pp_application'], 'puppet/puppetdb-database']],
78+
rule => ['and', ['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/puppetdb-database']],
8179
classes => {
8280
'puppet_enterprise::profile::database' => { },
8381
},
@@ -90,8 +88,8 @@
9088
ensure => present,
9189
parent => 'PE Infrastructure',
9290
rule => ['and',
93-
['=', ['trusted', 'extensions', 'pp_application'], 'puppet/master'],
94-
['=', ['trusted', 'extensions', 'pp_cluster'], 'A'],
91+
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/master'],
92+
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'A'],
9593
],
9694
data => {
9795
'puppet_enterprise::profile::primary_master_replica' => {
@@ -109,8 +107,8 @@
109107
ensure => 'present',
110108
parent => 'PE Master',
111109
rule => ['and',
112-
['=', ['trusted', 'extensions', 'pp_application'], 'puppet/compiler'],
113-
['=', ['trusted', 'extensions', 'pp_cluster'], 'A'],
110+
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/compiler'],
111+
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'A'],
114112
],
115113
classes => {
116114
'puppet_enterprise::profile::puppetdb' => {
@@ -144,8 +142,8 @@
144142
ensure => present,
145143
parent => 'PE Infrastructure',
146144
rule => ['and',
147-
['=', ['trusted', 'extensions', 'pp_application'], 'puppet/master'],
148-
['=', ['trusted', 'extensions', 'pp_cluster'], 'B'],
145+
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/master'],
146+
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'B'],
149147
],
150148
data => {
151149
'puppet_enterprise::profile::primary_master_replica' => {
@@ -161,8 +159,8 @@
161159
ensure => 'present',
162160
parent => 'PE Master',
163161
rule => ['and',
164-
['=', ['trusted', 'extensions', 'pp_application'], 'puppet/compiler'],
165-
['=', ['trusted', 'extensions', 'pp_cluster'], 'B'],
162+
['=', ['trusted', 'extensions', peadm::oid('peadm_role')], 'puppet/compiler'],
163+
['=', ['trusted', 'extensions', peadm::oid('peadm_availability_group')], 'B'],
166164
],
167165
classes => {
168166
'puppet_enterprise::profile::puppetdb' => {

plans/action/install.pp

+10-12
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,14 @@
182182
# Create csr_attributes.yaml files for the nodes that need them
183183
# There is a problem with OID names in csr_attributes.yaml for some
184184
# installs, e.g. PE 2019.0.1, PUP-9746. Use the raw OIDs for now.
185-
$pp_application = '1.3.6.1.4.1.34380.1.1.8'
186-
$pp_cluster = '1.3.6.1.4.1.34380.1.1.16'
187185

188186
run_task('peadm::mkdir_p_file', $master_target,
189187
path => '/etc/puppetlabs/puppet/csr_attributes.yaml',
190188
content => @("HEREDOC"),
191189
---
192190
extension_requests:
193-
${pp_application}: "puppet/master"
194-
${pp_cluster}: "A"
191+
${peadm::oid('peadm_role')}: "puppet/master"
192+
${peadm::oid('peadm_availability_group')}: "A"
195193
| HEREDOC
196194
)
197195

@@ -200,8 +198,8 @@
200198
content => @("HEREDOC"),
201199
---
202200
extension_requests:
203-
${pp_application}: "puppet/puppetdb-database"
204-
${pp_cluster}: "A"
201+
${peadm::oid('peadm_role')}: "puppet/puppetdb-database"
202+
${peadm::oid('peadm_availability_group')}: "A"
205203
| HEREDOC
206204
)
207205

@@ -210,8 +208,8 @@
210208
content => @("HEREDOC"),
211209
---
212210
extension_requests:
213-
${pp_application}: "puppet/puppetdb-database"
214-
${pp_cluster}: "B"
211+
${peadm::oid('peadm_role')}: "puppet/puppetdb-database"
212+
${peadm::oid('peadm_availability_group')}: "B"
215213
| HEREDOC
216214
)
217215

@@ -307,8 +305,8 @@
307305
'--puppet-service-ensure', 'stopped',
308306
"main:certname=${master_replica_target.peadm::target_name()}",
309307
"main:dns_alt_names=${dns_alt_names_csv}",
310-
"extension_requests:${pp_application}=puppet/master",
311-
"extension_requests:${pp_cluster}=B",
308+
"extension_requests:${peadm::oid('peadm_role')}=puppet/master",
309+
"extension_requests:${peadm::oid('peadm_availability_group')}=B",
312310
],
313311
)
314312

@@ -320,8 +318,8 @@
320318
'--puppet-service-ensure', 'stopped',
321319
"main:certname=${target.peadm::target_name()}",
322320
"main:dns_alt_names=${dns_alt_names_csv}",
323-
"extension_requests:${pp_application}=puppet/compiler",
324-
"extension_requests:${pp_cluster}=${group}",
321+
"extension_requests:${peadm::oid('peadm_role')}=puppet/compiler",
322+
"extension_requests:${peadm::oid('peadm_availability_group')}=${group}",
325323
],
326324
)
327325
}

plans/upgrade.pp

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@
5555

5656
# Determine which compilers are associated with which HA group
5757
$compiler_m1_targets = $compiler_targets.filter |$target| {
58-
$trusted_facts[$target]['pp_cluster'] == $trusted_facts[$master_target[0]]['pp_cluster']
58+
($trusted_facts[$target][peadm::oid('peadm_availability_group')]
59+
== $trusted_facts[$master_target[0]][peadm::oid('peadm_availability_group'])
5960
}
6061

6162
$compiler_m2_targets = $compiler_targets.filter |$target| {
62-
$trusted_facts[$target]['pp_cluster'] == $trusted_facts[$master_replica_target[0]]['pp_cluster']
63+
($trusted_facts[$target][peadm::oid('peadm_availability_group')]
64+
== $trusted_facts[$master_replica_target[0]][peadm::oid('peadm_availability_group'])
6365
}
6466

6567
###########################################################################

0 commit comments

Comments
 (0)