From 6ae1030e7f2b576f768d3f8d790c4b2667ce9c81 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 8 May 2018 09:58:43 +0200 Subject: [PATCH] switch from topscope to class scope for variables --- manifests/alerts.pp | 22 +++++++++++----------- manifests/config.pp | 6 +++--- manifests/daemon.pp | 2 +- manifests/init.pp | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manifests/alerts.pp b/manifests/alerts.pp index 6199fac52..f586de505 100644 --- a/manifests/alerts.pp +++ b/manifests/alerts.pp @@ -10,22 +10,22 @@ # define prometheus::alerts ( Variant[Array,Hash] $alerts, - String $location = "${::prometheus::config_dir}/rules", - String $version = $::prometheus::version, - String $user = $::prometheus::user, - String $group = $::prometheus::group, - String $bin_dir = $::prometheus::bin_dir, + String $location = "${prometheus::config_dir}/rules", + String $version = $prometheus::version, + String $user = $prometheus::user, + String $group = $prometheus::group, + String $bin_dir = $prometheus::bin_dir, ) { if ( versioncmp($version, '2.0.0') < 0 ){ file { "${location}/${name}.rules": ensure => 'file', owner => $user, group => $group, - notify => Class['::prometheus::service_reload'], + notify => Class['prometheus::service_reload'], content => epp("${module_name}/alerts.epp", {'alerts' => $alerts}), validate_cmd => "${bin_dir}/promtool check-rules %", - require => Class['::prometheus::install'], - before => Class['::prometheus::config'], + require => Class['prometheus::install'], + before => Class['prometheus::config'], } } else { @@ -33,11 +33,11 @@ ensure => 'file', owner => $user, group => $group, - notify => Class['::prometheus::service_reload'], + notify => Class['prometheus::service_reload'], content => $alerts.to_yaml, validate_cmd => "${bin_dir}/promtool check rules %", - require => Class['::prometheus::install'], - before => Class['::prometheus::config'], + require => Class['prometheus::install'], + before => Class['prometheus::config'], } } } diff --git a/manifests/config.pp b/manifests/config.pp index 78d5c1f13..2d1d61d49 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -43,9 +43,9 @@ # so any change there should trigger a full service restart if $prometheus::restart_on_change { File { - notify => [Class['::prometheus::run_service']], + notify => [Class['prometheus::run_service']], } - $systemd_notify = [Exec['prometheus-systemd-reload'], Class['::prometheus::run_service']] + $systemd_notify = [Exec['prometheus-systemd-reload'], Class['prometheus::run_service']] } else { $systemd_notify = Exec['prometheus-systemd-reload'] } @@ -68,7 +68,7 @@ } 'systemd' : { include 'systemd' - ::systemd::unit_file {'prometheus.service': + systemd::unit_file {'prometheus.service': content => template('prometheus/prometheus.systemd.erb'), } } diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 800d773ce..f652916bd 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -169,7 +169,7 @@ } 'systemd' : { include 'systemd' - ::systemd::unit_file {"${name}.service": + systemd::unit_file {"${name}.service": content => template('prometheus/daemon.systemd.erb'), notify => $notify_service, } diff --git a/manifests/init.pp b/manifests/init.pp index 8a3d7fe7b..aebaa43ed 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -179,7 +179,7 @@ } } - if( versioncmp($::prometheus::version, '1.0.0') == -1 ){ + if( versioncmp($prometheus::version, '1.0.0') == -1 ){ $real_download_url = pick($download_url, "${download_url_base}/download/${version}/${package_name}-${version}.${os}-${real_arch}.${download_extension}") } else { @@ -201,14 +201,14 @@ } $extra_alerts.each | String $alerts_file_name, Hash $alerts_config | { - ::prometheus::alerts { $alerts_file_name: + prometheus::alerts { $alerts_file_name: alerts => $alerts_config, } } $extra_rule_files = suffix(prefix(keys($extra_alerts), "${config_dir}/rules/"), '.rules') if ! empty($alerts) { - ::prometheus::alerts { 'alert': + prometheus::alerts { 'alert': alerts => $alerts, location => $config_dir, } @@ -219,10 +219,10 @@ } anchor {'prometheus_first': } - -> class { '::prometheus::install': + -> class { 'prometheus::install': purge_config_dir => $purge_config_dir, } - -> class { '::prometheus::config': + -> class { 'prometheus::config': global_config => $global_config, rule_files => $_rule_files, scrape_configs => $scrape_configs, @@ -231,7 +231,7 @@ config_template => $config_template, storage_retention => $storage_retention, } - -> class { '::prometheus::run_service': } - -> class { '::prometheus::service_reload': } + -> class { 'prometheus::run_service': } + -> class { 'prometheus::service_reload': } -> anchor {'prometheus_last': } }