Skip to content

Commit

Permalink
make gnupg class/wget package optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Dec 16, 2022
1 parent 49176a6 commit ec7a7bc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
14 changes: 9 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
Optional[String[1]] $proxy_url = undef,
Optional[String[1]] $no_proxy = undef,
Array[Hash[String[1], String[1]]] $signing_keys = $rvm::params::signing_keys,
Boolean $include_gnupg = true,
Boolean $manage_wget = true,
) inherits rvm::params {
if $install_rvm {
# rvm has now autolibs enabled by default so let it manage the dependencies
Expand All @@ -25,11 +27,13 @@
}

class { 'rvm::system':
version => $version,
proxy_url => $proxy_url,
no_proxy => $no_proxy,
signing_keys => $signing_keys,
install_from => $install_from,
version => $version,
proxy_url => $proxy_url,
no_proxy => $no_proxy,
signing_keys => $signing_keys,
install_from => $install_from,
include_gnupg => $include_gnupg,
manage_wget => $manage_wget,
}
}

Expand Down
33 changes: 19 additions & 14 deletions manifests/system.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Optional[String[1]] $no_proxy = undef,
Stdlib::Absolutepath $home = $facts['root_home'],
Array[Hash[String[1], String[1]]] $signing_keys = $rvm::params::signing_keys,
Boolean $include_gnupg = true,
Boolean $manage_wget = true,
) inherits rvm::params {
$actual_version = $version ? {
undef => 'latest',
Expand All @@ -24,21 +26,24 @@
$proxy_environment = concat($http_proxy_environment, $no_proxy_environment)
$environment = concat($proxy_environment, ["HOME=${home}"])

unless empty($signing_keys) {
include gnupg

# https keys are downloaded with wget
if $manage_wget {
ensure_packages(['wget'])
$signing_keys.each |Hash[String[1], String[1]] $key| {
gnupg_key { $key['id']:
ensure => 'present',
user => 'root',
key_id => $key['id'],
key_source => $key['source'],
key_type => public,
before => Exec['system-rvm'],
require => Class['gnupg'],
}
}
if $include_gnupg {
include gnupg
$dep = Class['gnupg']
} else {
$dep = undef
}
$signing_keys.each |Hash[String[1], String[1]] $key| {
gnupg_key { $key['id']:
ensure => 'present',
user => 'root',
key_id => $key['id'],
key_source => $key['source'],
key_type => public,
before => Exec['system-rvm'],
require => $dep,
}
}

Expand Down

0 comments on commit ec7a7bc

Please sign in to comment.