-
Notifications
You must be signed in to change notification settings - Fork 289
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
(GH-701) Stop using scope.lookupvar() in templates #724
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,71 @@ | |
# | ||
# Installs the Sensu packages | ||
# | ||
class sensu::package { | ||
# == Parameters | ||
# | ||
# [*deregister_handler*] | ||
# String. The handler to use when deregistering a client on stop. | ||
# Default: $::sensu::deregister_handler | ||
# | ||
# [*deregister_on_stop*] | ||
# Boolean. Whether the sensu client should deregister from the API on service stop | ||
# Default: $::sensu::deregister_on_stop | ||
# | ||
# [*gem_path*] | ||
# String. Paths to add to GEM_PATH if we need to look for different dirs. | ||
# Default: $::sensu::gem_path | ||
# | ||
# [*init_stop_max_wait*] | ||
# Integer. Number of seconds to wait for the init stop script to run | ||
# Default: $::sensu::init_stop_max_wait | ||
# | ||
# [*log_dir*] | ||
# String. Sensu log directory to be used | ||
# Default: $::sensu::log_dir | ||
# Valid values: Any valid log directory path, accessible by the sensu user | ||
# | ||
# [*log_level*] | ||
# String. Sensu log level to be used | ||
# Default: $::sensu::log_level | ||
# Valid values: debug, info, warn, error, fatal | ||
# | ||
# [*path*] | ||
# String. Used to set PATH in /etc/default/sensu | ||
# Default: $::sensu::path | ||
# | ||
# [*rubyopt*] | ||
# String. Ruby opts to be passed to the sensu services | ||
# Default: $::sensu::rubyopt | ||
# | ||
# [*use_embedded_ruby*] | ||
# Boolean. If the embedded ruby should be used, e.g. to install the | ||
# sensu-plugin gem. This value is overridden by a defined | ||
# sensu_plugin_provider. Note, the embedded ruby should always be used to | ||
# provide full compatibility. Using other ruby runtimes, e.g. the system | ||
# ruby, is not recommended. | ||
# Default: $::sensu::use_embedded_ruby | ||
# Valid values: true, false | ||
# | ||
class sensu::package ( | ||
$deregister_handler = $::sensu::deregister_handler, | ||
$deregister_on_stop = $::sensu::deregister_on_stop, | ||
$gem_path = $::sensu::gem_path, | ||
$init_stop_max_wait = $::sensu::init_stop_max_wait, | ||
$log_dir = $::sensu::log_dir, | ||
$log_level = $::sensu::log_level, | ||
$path = $::sensu::path, | ||
$rubyopt = $::sensu::rubyopt, | ||
$use_embedded_ruby = $::sensu::use_embedded_ruby, | ||
) { | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
if $path != '$PATH' { | ||
validate_absolute_path($path) | ||
} | ||
|
||
case $::osfamily { | ||
|
||
'Debian': { | ||
|
@@ -49,7 +108,7 @@ | |
# $pkg_version is passed to Package[sensu] { ensure }. The Windows MSI | ||
# provider translates hyphens to dots, e.g. '0.29.0-11' maps to | ||
# '0.29.0.11' on the system. This mapping is necessary to converge. | ||
$pkg_version = template('sensu/sensu-windows-package-version.erb') | ||
$pkg_version = regsubst($::sensu::version, '-', '.') | ||
# The version used to construct the download URL. | ||
$pkg_url_version = $::sensu::version ? { | ||
'installed' => 'latest', | ||
|
@@ -69,7 +128,7 @@ | |
# The OS Release specific sub-folder | ||
$os_release = $facts['os']['release']['major'] | ||
# e.g. '2012 R2' => '2012r2' | ||
$pkg_url_dir = template('sensu/sensu-version.erb') | ||
$pkg_url_dir = regsubst($os_release, '^(\d+)\s*[rR](\d+)', '\\1r\\2') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as for line 111 above ($pkg_version in package.pp) |
||
$pkg_arch = $facts['os']['architecture'] | ||
$pkg_url = "${sensu::windows_repo_prefix}/${pkg_url_dir}/sensu-${pkg_url_version}-${pkg_arch}.msi" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same is true for sensu-version.erb. I have created the issue #731 to get it changed later on too.