Skip to content

Commit

Permalink
Move repo_class to parameter and put value in module hiera data
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Jun 1, 2018
1 parent fc141ea commit af9a588
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
sensu::repo_class: 'sensu::repo::yum'

11 changes: 11 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "osfamily"
path: "os/%{facts.os.family}.yaml"
- name: "common"
path: "common.yaml"

4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
},
Boolean $etc_dir_purge = true,
Boolean $manage_repo = true,
Optional[String] $repo_class = undef,
) {

include ::sensu::repo
include ::sensu::agent

file { 'sensu_etc_dir':
Expand All @@ -35,11 +37,9 @@

case $osfamily {
'RedHat': {
$repo_class = '::sensu::repo::yum'
}
default: {
fail("Detected osfamily <${::osfamily}>. Only RedHat is supported.")
}
}
include ::sensu::repo
}
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
:ipaddress => '127.0.0.1',
:kernel => 'Linux',
:osfamily => 'RedHat',
:os => {
:family => 'RedHat',
},
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '7',
:fqdn => 'testfqdn.example.com',
Expand Down

0 comments on commit af9a588

Please sign in to comment.