Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide the ability to change the package name. #51

Merged
merged 1 commit into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# === Parameters
#
# [*package_name*]
# String. Package name.
#
# [*ensure*]
# String. State of the telegraf package. You can also specify a
# particular version to install.
Expand Down Expand Up @@ -79,6 +82,7 @@
# String. URL for windows telegraf chocolatey repo
#
class telegraf (
$package_name = $telegraf::params::package_name,
$ensure = $telegraf::params::ensure,
$config_file = $telegraf::params::config_file,
$config_file_owner = $telegraf::params::config_file_owner,
Expand Down Expand Up @@ -111,6 +115,7 @@
$service_hasstatus = $telegraf::params::service_hasstatus
$service_restart = $telegraf::params::service_restart

validate_string($package_name)
validate_string($ensure)
validate_string($config_file)
validate_string($config_file_owner)
Expand Down
8 changes: 4 additions & 4 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'source' => 'https://repos.influxdata.com/influxdb.key',
},
}
Class['apt::update'] -> Package['telegraf']
Class['apt::update'] -> Package[$::telegraf::package_name]
}
'RedHat': {
yumrepo { 'influxdata':
Expand All @@ -33,7 +33,7 @@
gpgkey => 'https://repos.influxdata.com/influxdb.key',
gpgcheck => 1,
}
Yumrepo['influxdata'] -> Package['telegraf']
Yumrepo['influxdata'] -> Package[$::telegraf::package_name]
}
'windows': {
# repo is not applicable to windows
Expand All @@ -49,13 +49,13 @@
require chocolatey

# package install
package { 'telegraf':
package { $::telegraf::package_name:
ensure => $::telegraf::ensure,
provider => chocolatey,
source => $::telegraf::windows_package_url,
}
} else {
ensure_packages(['telegraf'], { ensure => $::telegraf::ensure })
ensure_packages([$::telegraf::package_name], { ensure => $::telegraf::ensure })
}

}
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$service_hasstatus = true
$service_restart = 'pkill -HUP telegraf'
}

$package_name = 'telegraf'
$ensure = 'present'
$hostname = $::hostname
$omit_hostname = false
Expand Down