Skip to content

Commit

Permalink
Merge pull request bfraser#66 from wyardley/data_types
Browse files Browse the repository at this point in the history
BREAKING: Switch to Puppet Data Types (ldap_cfg is now undef when disabled)
  • Loading branch information
bastelfreak authored Sep 20, 2017
2 parents 4440767 + c4dbc51 commit 36aab85
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
39 changes: 17 additions & 22 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,25 @@
# }
#
class grafana (
$archive_source = $::grafana::params::archive_source,
$cfg_location = $::grafana::params::cfg_location,
$cfg = $::grafana::params::cfg,
$ldap_cfg = $::grafana::params::ldap_cfg,
$container_cfg = $::grafana::params::container_cfg,
$container_params = $::grafana::params::container_params,
$data_dir = $::grafana::params::data_dir,
$install_dir = $::grafana::params::install_dir,
$install_method = $::grafana::params::install_method,
$manage_package_repo = $::grafana::params::manage_package_repo,
$package_name = $::grafana::params::package_name,
$package_source = $::grafana::params::package_source,
$repo_name = $::grafana::params::repo_name,
$rpm_iteration = $::grafana::params::rpm_iteration,
$service_name = $::grafana::params::service_name,
$version = $::grafana::params::version,
$plugins = {}
Optional[String] $archive_source = undef,
String $cfg_location = $::grafana::params::cfg_location,
Hash $cfg = $::grafana::params::cfg,
Optional[Hash] $ldap_cfg = undef,
Boolean $container_cfg = $::grafana::params::container_cfg,
Hash $container_params = $::grafana::params::container_params,
String $data_dir = $::grafana::params::data_dir,
String $install_dir = $::grafana::params::install_dir,
String $install_method = $::grafana::params::install_method,
Boolean $manage_package_repo = $::grafana::params::manage_package_repo,
String $package_name = $::grafana::params::package_name,
Optional[String] $package_source = undef,
Enum['stable', 'testing'] $repo_name = $::grafana::params::repo_name,
String $rpm_iteration = $::grafana::params::rpm_iteration,
String $service_name = $::grafana::params::service_name,
String $version = $::grafana::params::version,
Hash $plugins = {}
) inherits grafana::params {

# validate parameters here
if !is_hash($cfg) {
fail('cfg parameter must be a hash')
}

contain grafana::install
contain grafana::config
contain grafana::service
Expand Down
3 changes: 0 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
# It sets variables according to platform
#
class grafana::params {
$archive_source = undef
$cfg = {}
$container_cfg = false
$container_params = {}
$data_dir = '/var/lib/grafana'
$docker_image = 'grafana/grafana'
$docker_ports = '3000:3000'
$install_dir = '/usr/share/grafana'
$ldap_cfg = false
$package_name = 'grafana'
$package_source = undef
$rpm_iteration = '1'
$repo_name = 'stable'
$version = '4.5.1'
Expand Down
10 changes: 0 additions & 10 deletions spec/classes/grafana_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,6 @@

context 'invalid parameters' do
context 'cfg' do
describe 'should raise an error when cfg parameter is not a hash' do
let(:params) do
{
cfg: []
}
end

it { expect { is_expected.to contain_package('grafana') }.to raise_error(Puppet::Error, %r{cfg parameter must be a hash}) }
end

describe 'should not raise an error when cfg parameter is a hash' do
let(:params) do
{
Expand Down

0 comments on commit 36aab85

Please sign in to comment.