Skip to content

Commit

Permalink
Handle Nexus versions >= 3.67.0-03 (#62)
Browse files Browse the repository at this point in the history
* Handle Nexus versions >= 3.67.0-03

---------

Co-authored-by: Pierre Baret <[email protected]>
  • Loading branch information
PiR-B and Pierre Baret authored Jun 21, 2024
1 parent 50079d3 commit bf13aef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
25 changes: 16 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
#
# @see https://help.sonatype.com/repomanager3/product-information/download/download-archives---repository-manager-3
#
# @param version
# The version to download, install and manage.
# @param download_folder
# Destination folder of the downloaded archive.
# @param download_site
# Download uri which will be appended with filename of the archive to download.
# @param download_proxy
# Proxyserver address which will be used to download the archive file.
# @param install_root
# The root filesystem path where the downloaded archive will be extracted to.
# @param work_dir
Expand Down Expand Up @@ -38,21 +34,25 @@
# @param package_type
# Select 'src' for Source download & install. 'pkg' will fetch te specified package and version
# from repos you must provide.
# @param package_name
# The name of the package to install. Default 'nexus'
# @param package_ensure
# The version to install. See https://puppet.com/docs/puppet/7/types/package.html#package-attribute-ensure
# @param download_proxy
# Proxyserver address which will be used to download the archive file.
# @param version
# The version to download, install and manage.
# @param java_runtime
# The Java runtime to be utilized. Relevant only for Nexus versions >= 3.67.0-03.
# @param package_name
# The name of the package to install. Default 'nexus'
#
# @example
# class{ 'nexus':
# version => '3.37.3-02',
# }
#
class nexus (
Optional[Pattern[/3.\d+.\d+-\d+/]] $version,
Stdlib::Absolutepath $download_folder,
Stdlib::HTTPUrl $download_site,
Optional[Stdlib::HTTPUrl] $download_proxy,
Stdlib::Absolutepath $install_root,
Stdlib::Absolutepath $work_dir,
String[1] $user,
Expand All @@ -66,11 +66,18 @@
Boolean $purge_installations,
Boolean $purge_default_repositories,
Enum['src', 'pkg'] $package_type,
Optional[String] $package_name,
String $package_ensure,
Optional[Stdlib::HTTPUrl] $download_proxy = undef,
Optional[Pattern[/3.\d+.\d+-\d+/]] $version = undef,
Optional[Enum['java8', 'java11']] $java_runtime = undef,
Optional[String] $package_name = undef,
) {
include stdlib

if ($version and versioncmp($version, '3.67.0-03') >= 0 and ! $java_runtime) {
fail('You need to define the $java_runtime parameter.')
}

contain nexus::user
contain nexus::package

Expand Down
9 changes: 8 additions & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
if !$nexus::version {
fail('nexus::version must be set when using package_type => src')
}
$nexus_archive = "nexus-${nexus::version}-unix.tar.gz"

if $nexus::java_runtime {
# Relevant only for Nexus versions >= 3.67.0-03
$nexus_archive = "nexus-${nexus::version}-${nexus::java_runtime}-unix.tar.gz"
} else {
$nexus_archive = "nexus-${nexus::version}-unix.tar.gz"
}

$download_url = "${nexus::download_site}/${nexus_archive}"
$dl_file = "${nexus::download_folder}/${nexus_archive}"
$install_dir = "${nexus::install_root}/nexus-${nexus::version}"
Expand Down

0 comments on commit bf13aef

Please sign in to comment.