Skip to content

Commit

Permalink
Introduce a defined type for hammer plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored and mmoll committed Apr 13, 2018
1 parent dc4968f commit b04778a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
3 changes: 1 addition & 2 deletions manifests/cli/openscap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# === Parameters:
#
class foreman::cli::openscap {
package { "${::foreman::cli::hammer_plugin_prefix}foreman_openscap":
ensure => installed,
foreman::cli::plugin { 'foreman_openscap':
}
}
30 changes: 30 additions & 0 deletions manifests/cli/plugin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# == Hammer plugin
#
# A generic way to install plugins
#
# === Parameters:
#
# $package:: The package name
#
# $version:: The package version to ensure
#
define foreman::cli::plugin (
String $package = "${::foreman::cli::hammer_plugin_prefix}${title}",
String $version = 'installed',
) {
# Debian gem2deb converts underscores to hyphens
case $::osfamily {
'Debian': {
$real_package = regsubst($package,'_','-','G')
}
default: {
$real_package = $package
}
}

package { $real_package:
ensure => $version,
# Ensures we are installing after the repositories are set up
require => Package['foreman-cli'],
}
}

0 comments on commit b04778a

Please sign in to comment.