Skip to content

Commit

Permalink
Merge pull request #6 from elmuerte/master
Browse files Browse the repository at this point in the history
Do not produce a HA policy config when $ha_policy is unset
  • Loading branch information
fraenki authored Aug 2, 2023
2 parents ce2e08d + 6c3caa7 commit 4e1425b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
4 changes: 3 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,12 @@ Default value: ``undef``

##### `ha_policy`

Data type: `Enum['live-only','replication','shared-storage']`
Data type: `Optional[Enum['live-only','replication','shared-storage']]`

ActiveMQ Artemis HA policy.

Default value: ``undef``

##### `initial_replication_sync_timeout`

Data type: `Integer`
Expand Down
2 changes: 1 addition & 1 deletion manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
Hash[String[1], Hash] $connectors,
Array $discovery_groups,
Boolean $failover_on_shutdown,
Enum['live-only','replication','shared-storage'] $ha_policy,
Integer $initial_replication_sync_timeout,
Integer $journal_buffer_timeout,
Boolean $journal_datasync,
Expand All @@ -162,6 +161,7 @@
Optional[Boolean] $service_enable = undef,
Optional[Enum['running','stopped']] $service_ensure = undef,
Optional[String] $target_host = undef,
Optional[Enum['live-only','replication','shared-storage']] $ha_policy,
# TODO: broker-plugins (nothing set by default, but it should be supported)
) {
File {
Expand Down
32 changes: 18 additions & 14 deletions templates/broker.xml.epp
Original file line number Diff line number Diff line change
Expand Up @@ -157,33 +157,37 @@ under the License.
</cluster-connection>
</cluster-connections>
<% if $ha_policy { -%>
<ha-policy>
<<%= $ha_policy %>>
<% if $ha_policy == 'replication' or $ha_policy == 'shared-storage' { -%>
<<%= $role %>>
<% if !empty($group) { -%>
<% if !empty($group) { -%>
<group-name><%= $group %></group-name>
<% } -%>
<% } -%>
<cluster-name><%= $activemq::cluster_name %></cluster-name>
<% if $ha_policy == 'replication' { -%>
<% if $ha_policy == 'replication' { -%>
<initial-replication-sync-timeout><%= $initial_replication_sync_timeout %></initial-replication-sync-timeout>
<% if $check_for_live_server and $role == 'master' { -%>
<% if $check_for_live_server and $role == 'master' { -%>
<check-for-live-server>true</check-for-live-server>
<% } -%>
<% if $vote_on_replication_failure and $role == 'master' { -%>
<% } -%>
<% if $vote_on_replication_failure and $role == 'master' { -%>
<vote-on-replication-failure>true</vote-on-replication-failure>
<% } -%>
<% } -%>
<% if $ha_policy == 'shared-storage' { -%>
<% if $failover_on_shutdown and $role == 'master' { -%>
<% } -%>
<% } -%>
<% if $ha_policy == 'shared-storage' { -%>
<% if $failover_on_shutdown and $role == 'master' { -%>
<failover-on-shutdown>true</failover-on-shutdown>
<% } -%>
<% } -%>
<% if $allow_failback and $role == 'slave' { -%>
<% } -%>
<% } -%>
<% if $allow_failback and $role == 'slave' { -%>
<allow-failback>true</allow-failback>
<% } -%>
<% } -%>
</<%= $role %>>
<% } -%>
</<%= $ha_policy %>>
</ha-policy>
<% } -%>
<% } -%>

<% if (('enable' in $security) and ($security['enable'] == true)) { -%>
Expand Down

0 comments on commit 4e1425b

Please sign in to comment.