|
7 | 7 | $obmondo_classes = lookup('classes', Array[String], undef, []).functions::knockout |
8 | 8 |
|
9 | 9 | # Check if the given class is role::monitoring only. |
10 | | -# If role::monitoring is mixed with other class, then fail |
| 10 | +# If role::monitoring is mixed with other role, then fail |
11 | 11 | if 'role::monitoring' in $obmondo_classes { |
12 | 12 | if $obmondo_classes.size != 1 { |
13 | 13 | fail("role::monitoring can not be included with other roles ${obmondo_classes.join(',')}") |
|
19 | 19 | } |
20 | 20 |
|
21 | 21 | # Fail if more than one "unblendable" class is used at once. |
22 | | -# |
23 | | -# Because we're a bit special we only warn if the customer is EnableIT; however |
24 | | -# we should strive to fix this so that we can properly dogfood! |
25 | 22 | $obmondo_classes.filter |$_class| { |
26 | 23 | !lookup("${_class}::__blendable", Boolean, undef, false) |
27 | 24 | }.then |$_obmondo_unblendable_classes| { |
|
55 | 52 | default => 'disabled', |
56 | 53 | } |
57 | 54 |
|
58 | | -$_has_tags = case $obmondo_tags { |
| 55 | +$_has_tags = $obmondo_tags ? { |
59 | 56 | Array => $obmondo_tags.delete_undef_values.empty, |
60 | 57 | default => [] |
61 | 58 | } |
|
66 | 63 | | EOT |
67 | 64 | } |
68 | 65 |
|
69 | | -$_subs_info = if $obmondo_monitoring_status { |
| 66 | +$_subs_info = if $subscription { |
70 | 67 | @("EOT"/$n) |
71 | 68 | Subscription Level: ${subscription} |
72 | 69 | | EOT |
|
82 | 79 | info { $_node_info_msg: } |
83 | 80 |
|
84 | 81 | node default { |
85 | | - # Load role when no class is present, but tag is given |
| 82 | + # No class or tags is given, ask user to add it |
86 | 83 | if $obmondo_classes.empty and $_has_tags.size == 0 { |
87 | 84 | $_role_msg = @("EOT"/$n) |
88 | 85 |
|
|
99 | 96 | info { $_role_msg: } |
100 | 97 | } |
101 | 98 |
|
102 | | - if $obmondo_classes.empty and $obmondo_tags.delete_undef_values.size > 0 { |
| 99 | + # Load default role when no class is given and has no tags |
| 100 | + if $obmondo_classes.empty and $_has_tags.size > 0 { |
103 | 101 | ::role.include |
104 | | - } else { |
| 102 | + } |
| 103 | +
|
| 104 | + # Load the given role give in the hiera |
| 105 | + if !$obmondo_classes.empty { |
105 | 106 | $obmondo_classes.include |
106 | 107 | } |
107 | 108 | } |
0 commit comments