Skip to content

Commit

Permalink
Replace anchors by contain & require
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Aug 8, 2023
1 parent d2df17e commit 497e5a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
13 changes: 5 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -170,24 +170,21 @@
}
}

include zookeeper::install
include zookeeper::config
anchor { 'zookeeper::start': }
-> Class['zookeeper::install']
contain zookeeper::install
contain zookeeper::config
Class['zookeeper::install']
-> Class['zookeeper::config']

if ($use_sasl_auth) {
include zookeeper::sasl
contain zookeeper::sasl
Class['zookeeper::config']
-> Class['zookeeper::sasl']
-> Class['zookeeper::service']
}

if ($manage_service) and ($service_provider != 'exhibitor') {
include zookeeper::service
contain zookeeper::service
Class['zookeeper::config']
-> Class['zookeeper::service']
-> Anchor['zookeeper::end']
}
anchor { 'zookeeper::end': }
}
43 changes: 16 additions & 27 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
#
# This module manages installation tasks.
#
# PRIVATE CLASS - do not use directly (use main `zookeeper` class).
# @private - do not use directly (use main `zookeeper` class).
class zookeeper::install inherits zookeeper {
anchor { 'zookeeper::install::begin': }

$os_family = $facts['os']['family']

# Java installation
Expand All @@ -15,52 +13,43 @@
}

# Make sure the Java package is only installed once.
anchor { 'zookeeper::install::java': }

ensure_resource('package', $zookeeper::java_package,
{ 'ensure' => $zookeeper::ensure,
ensure_resource('package', $zookeeper::java_package, {
'ensure' => $zookeeper::ensure,
'allow_virtual' => true,
'before' => Anchor['zookeeper::install::intermediate'],
'require' => Anchor['zookeeper::install::begin']
'before' => Class['zookeeper::post_install'],
}
)
}

anchor { 'zookeeper::install::intermediate': }

# Package installation
case $zookeeper::install_method {
'archive': {
include zookeeper::install::archive
Anchor['zookeeper::install::intermediate']
-> Class['zookeeper::install::archive']
-> Anchor['zookeeper::install::end']
contain zookeeper::install::archive

Class['zookeeper::install::archive']
-> Class['zookeeper::post_install']
}
'package': {
# Repo management
case $os_family {
'RedHat', 'Suse': {
include zookeeper::install::repo
Anchor['zookeeper::install::begin']
-> Class['zookeeper::install::repo']
contain zookeeper::install::repo

Class['zookeeper::install::repo']
-> Class['zookeeper::post_install']
}
default: {} # nothing to do
}

include zookeeper::install::package
Anchor['zookeeper::install::intermediate']
-> Class['zookeeper::install::package']
-> Anchor['zookeeper::install::end']
contain zookeeper::install::package
Class['zookeeper::install::package']
-> Class['zookeeper::post_install']
}
default: {
fail('Valid installation methods are `package` or `archive`')
}
}

anchor { 'zookeeper::install::end': }

# Post installation tasks
class { 'zookeeper::post_install':
require => Anchor['zookeeper::install::end'],
}
contain zookeeper::post_install
}

0 comments on commit 497e5a7

Please sign in to comment.