Skip to content

Commit

Permalink
Removing the assert_private() function from all private classes and i…
Browse files Browse the repository at this point in the history
…nheriting from the parent.

This helps with the automated testability of the module by allowing the classes
to be in their own describe blocks with the parameters that only affect
the resources managed by those classes.
  • Loading branch information
corey-hammerton committed Oct 13, 2017
1 parent 23e3c3c commit 56549f9
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 537 deletions.
5 changes: 2 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# metricbeat::config
# @api private
#
# Manages the state and contests of Metricbeat's configuration file
#
# @summary Manages Metricbeat's configuration file
class metricbeat::config {
assert_private()

class metricbeat::config inherits metricbeat {
$validate_cmd = $metricbeat::disable_configtest ? {
true => undef,
default => '/usr/share/metricbeat/bin/metricbeat -configtest -c %',
Expand Down
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#
# * `modules`
# Tuple[Hash] The array of modules this instance of metricbeat will
# collect. Required!
# collect. (default: [{}])
#
# * `outputs`
# [Hash] Configures the output(s) this Metricbeat instance should send
# to. Required!
# to. (default: {})
#
# * `beat_name`
# [String] The name of the beat which is published as the `beat.name`
Expand Down Expand Up @@ -90,8 +90,8 @@
# `tag` field of each published transaction. This is useful for
# identifying groups of servers by logical property. (default: undef)
class metricbeat(
Tuple[Hash] $modules,
Hash $outputs,
Tuple[Hash] $modules = [{}],
Hash $outputs = {},
String $beat_name = $::hostname,
Boolean $disable_configtest = false,
Enum['present', 'absent'] $ensure = 'present',
Expand Down
5 changes: 2 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# metricbeat::install
# @api private
#
# Manages the state of Package['metricbeat']
#
# @summary Manages the state of Package['metricbeat']
class metricbeat::install {
assert_private()

class metricbeat::install inherits metricbeat {
if $metricbeat::ensure == 'present' {
$package_ensure = $metricbeat::package_ensure
}
Expand Down
5 changes: 2 additions & 3 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# metricbeat::repo
# @api private
#
# If included, configure the relevant repo manager on the target node.
#
# @summary Manages the relevant repo manager on the target node.
class metricbeat::repo {
assert_private()

class metricbeat::repo inherits metricbeat {
case $facts['osfamily'] {
'Debian': {
include ::apt
Expand Down
5 changes: 2 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# metricbeat::service
# @api private
#
# Manages the state of Service['metricbeat']
#
# @summary Manages the state of Service['metricbeat']
class metricbeat::service {
assert_private()

class metricbeat::service inherits metricbeat {
if $metricbeat::ensure == 'present' {
case $metricbeat::service_ensure {
'enabled': {
Expand Down
11 changes: 0 additions & 11 deletions spec/classes/config_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/classes/install_spec.rb

This file was deleted.

Loading

0 comments on commit 56549f9

Please sign in to comment.