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

(CONT-356) Syntax update #543

Merged
merged 3 commits into from Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions .puppet-lint.rc
@@ -1,5 +1 @@
--relative
--no-parameter_types-check
--no-relative_classname_inclusion-check
--no-legacy_facts-check
--no-anchor_resource-check
6 changes: 0 additions & 6 deletions .sync.yml
Expand Up @@ -28,9 +28,3 @@ spec/spec_helper.rb:
unmanaged: false
.travis.yml:
delete: true
Rakefile:
extra_disabled_lint_checks:
- parameter_types
- relative_classname_inclusion
- legacy_facts
- anchor_resource
5 changes: 0 additions & 5 deletions Rakefile
Expand Up @@ -42,11 +42,6 @@ def changelog_future_release
end

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_parameter_types')
PuppetLint.configuration.send('disable_relative_classname_inclusion')
PuppetLint.configuration.send('disable_legacy_facts')
PuppetLint.configuration.send('disable_anchor_resource')


if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
Expand Down
34 changes: 17 additions & 17 deletions manifests/adopt.pp
Expand Up @@ -13,7 +13,8 @@
# Major version which should be installed, e.g. '8u101' or '9.0.4'. Must be used together with version_minor.
#
# @param version_minor
# Minor version which should be installed, e.g. 'b12' (for version = '8') or '11' (for version != '8'). Must be used together with version_major.
# Minor version which should be installed, e.g. 'b12' (for version = '8') or '11' (for version != '8').
# Must be used together with version_major.
#
# @param java
# Type of Java Standard Edition to install, jdk or jre.
Expand All @@ -32,7 +33,7 @@
# /usr/lib/jvm for Debian and /usr/java for RedHat.
#
# @param manage_basedir
# Whether to manage the basedir directory. Defaults to false.
# Whether to manage the basedir directory.
# Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter.
#
# @param package_type
Expand All @@ -47,22 +48,22 @@
# The name for the optional symlink in the installation directory.
#
define java::adopt (
$ensure = 'present',
$version = '8',
$version_major = undef,
$version_minor = undef,
$java = 'jdk',
$proxy_server = undef,
$proxy_type = undef,
$url = undef,
$basedir = undef,
$manage_basedir = true,
$package_type = undef,
$manage_symlink = false,
$symlink_name = undef,
String[1] $ensure = 'present',
LukasAud marked this conversation as resolved.
Show resolved Hide resolved
String[1] $version = '8',
Optional[String] $version_major = undef,
Optional[String] $version_minor = undef,
String $java = 'jdk',
LukasAud marked this conversation as resolved.
Show resolved Hide resolved
Optional[String] $proxy_server = undef,
Optional[String] $proxy_type = undef,
Optional[String] $url = undef,
Optional[String] $basedir = undef,
Boolean $manage_basedir = true,
Optional[String] $package_type = undef,
Boolean $manage_symlink = false,
Optional[String] $symlink_name = undef,
) {
# archive module is used to download the java package
include ::archive
include archive

# validate java Standard Edition to download
if $java !~ /(jre|jdk)/ {
Expand Down Expand Up @@ -188,7 +189,6 @@

# set java architecture nomenclature
$os_architecture = $facts['os']['architecture'] ? {
undef => $facts['architecture'],
default => $facts['os']['architecture']
}

Expand Down
27 changes: 13 additions & 14 deletions manifests/adoptium.pp
Expand Up @@ -42,21 +42,21 @@
# The name for the optional symlink in the installation directory.
#
define java::adoptium (
$ensure = 'present',
$version_major = undef,
$version_minor = undef,
$version_patch = undef,
$version_build = undef,
$proxy_server = undef,
$proxy_type = undef,
$url = undef,
$basedir = undef,
$manage_basedir = true,
$manage_symlink = false,
$symlink_name = undef,
String[1] $ensure = 'present',
LukasAud marked this conversation as resolved.
Show resolved Hide resolved
Optional[String] $version_major = undef,
Optional[String] $version_minor = undef,
Optional[String] $version_patch = undef,
Optional[String] $version_build = undef,
Optional[String] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Optional[String] $url = undef,
Optional[String] $basedir = undef,
Boolean $manage_basedir = true,
Boolean $manage_symlink = false,
Optional[String] $symlink_name = undef,
) {
# archive module is used to download the java package
include ::archive
include archive

$install_path = "jdk-${version_major}.${version_minor}.${version_patch}+${version_build}"

Expand Down Expand Up @@ -93,7 +93,6 @@

# set java architecture nomenclature
$os_architecture = $facts['os']['architecture'] ? {
undef => $facts['architecture'],
default => $facts['os']['architecture']
}

Expand Down
30 changes: 15 additions & 15 deletions manifests/download.pp
Expand Up @@ -54,21 +54,21 @@
# The name for the optional symlink in the installation directory.
#
define java::download (
$ensure = 'present',
$version = '8',
$version_major = undef,
$version_minor = undef,
$java_se = 'jdk',
$proxy_server = undef,
$proxy_type = undef,
$url = undef,
$jce = false,
$jce_url = undef,
$basedir = undef,
$manage_basedir = false,
$package_type = undef,
$manage_symlink = false,
$symlink_name = undef,
String[1] $ensure = 'present',
LukasAud marked this conversation as resolved.
Show resolved Hide resolved
String[1] $version = '8',
Optional[String] $version_major = undef,
Optional[String] $version_minor = undef,
String[1] $java_se = 'jdk',
Optional[String] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Optional[String] $url = undef,
Boolean $jce = false,
Optional[String] $jce_url = undef,
Optional[String] $basedir = undef,
Boolean $manage_basedir = false,
Optional[String] $package_type = undef,
Boolean $manage_symlink = false,
Optional[String] $symlink_name = undef,
) {
# archive module is used to download the java package
include archive
Expand Down
20 changes: 9 additions & 11 deletions manifests/init.pp
Expand Up @@ -36,15 +36,15 @@
# environment variable.
#
class java (
String $distribution = 'jdk',
Pattern[/present|installed|latest|^[.+_0-9a-zA-Z:~-]+$/] $version = 'present',
Optional[String] $package = undef,
Optional[Array] $package_options = undef,
Optional[String] $java_alternative = undef,
Optional[String] $java_alternative_path = undef,
Optional[String] $java_home = undef
String $distribution = 'jdk',
Pattern[/present|installed|latest|^[.+_0-9a-zA-Z:~-]+$/] $version = 'present',
Optional[String] $package = undef,
Optional[Array] $package_options = undef,
Optional[String] $java_alternative = undef,
Optional[String] $java_alternative_path = undef,
Optional[String] $java_home = undef
) {
include ::java::params
contain java::params

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why contain here instead of include (considering java::params doesn't declare any resources and only sets variables).


$default_package_name = has_key($java::params::java, $distribution) ? {
false => undef,
Expand Down Expand Up @@ -118,12 +118,10 @@
}
}

anchor { 'java::begin:': }
-> package { 'java':
package { 'java':
ensure => $version,
install_options => $package_options,
name => $use_java_package_name,
}
-> class { 'java::config': }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java::config used to be contained by java with this anchor pattern. Following this change it isn't anymore. Therefore if anyone has any calling code that eg. did a require java or service {'foo': require => 'java'} the configuration of java is now not guaranteed to happen first.

-> anchor { 'java::end': }
}
25 changes: 12 additions & 13 deletions manifests/sap.pp
Expand Up @@ -26,7 +26,7 @@
# /usr/lib/jvm for Debian and /usr/java for RedHat.
#
# @param manage_basedir
# Whether to manage the basedir directory. Defaults to false.
# Whether to manage the basedir directory.
# Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter.
#
# @param manage_symlink
Expand All @@ -36,19 +36,19 @@
# The name for the optional symlink in the installation directory.
#
define java::sap (
$ensure = 'present',
$version = '8',
$version_full = undef,
$java = 'jdk',
$proxy_server = undef,
$proxy_type = undef,
$basedir = undef,
$manage_basedir = true,
$manage_symlink = false,
$symlink_name = undef,
String[1] $ensure = 'present',
LukasAud marked this conversation as resolved.
Show resolved Hide resolved
String[1] $version = '8',
Optional[String] $version_full = undef,
String[1] $java = 'jdk',
Optional[String] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Optional[String] $basedir = undef,
Boolean $manage_basedir = true,
Boolean $manage_symlink = false,
Optional[String] $symlink_name = undef,
) {
# archive module is used to download the java package
include ::archive
include archive

# validate java edition to download
if $java !~ /(jre|jdk)/ {
Expand Down Expand Up @@ -128,7 +128,6 @@
}

$_os_architecture = $facts['os']['architecture'] ? {
undef => $facts['architecture'],
default => $facts['os']['architecture']
}

Expand Down