Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
fixtures:
repositories:
stdlib: https://github.com/puppetlabs/puppetlabs-stdlib
alternatives: https://github.com/voxpupuli/puppet-alternatives
17 changes: 17 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Classes

* [`example`](#example): An example class
* [`example::profile_java`](#example--profile_java)

## Classes

Expand Down Expand Up @@ -37,3 +38,19 @@ The content in the file

Default value: `'Hello World!'`

### <a name="example--profile_java"></a>`example::profile_java`

The example::profile_java class.

#### Parameters

The following parameters are available in the `example::profile_java` class:

* [`version`](#-example--profile_java--version)

##### <a name="-example--profile_java--version"></a>`version`

Data type: `Enum['8', '11', '17', '21']`



17 changes: 17 additions & 0 deletions manifests/profile_java.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class example::profile_java (
Enum['8', '11', '17', '21'] $version,
) {
$_version = $version ? {
'8' => '1.8.0',
default => $version,
}
package { 'java':
ensure => present,
name => "java-${_version}-openjdk",
}

alternatives { 'java':
path => "java-${_version}-openjdk.${facts['os']['architecture']}",
require => Package['java'],
}
}
19 changes: 0 additions & 19 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,12 @@
"9"
]
},
{
"operatingsystem": "Archlinux"
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"9"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"11",
"12",
"13"
]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": [
Expand All @@ -68,14 +57,6 @@
"8",
"9"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"20.04",
"22.04",
"24.04"
]
}
]
}
19 changes: 19 additions & 0 deletions spec/classes/profile_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'example::profile_java' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:params) do
{ 'version' => '11' }
end

it { is_expected.to compile.with_all_deps }

Check failure on line 13 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on fedora-41-x86_64 is expected to compile into a catalogue without dependency cycles Failure/Error: it { is_expected.to compile.with_all_deps } error during compilation: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)

Check failure on line 13 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on centos-9-x86_64 is expected to compile into a catalogue without dependency cycles Failure/Error: it { is_expected.to compile.with_all_deps } error during compilation: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)

Check failure on line 13 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-9-x86_64 is expected to compile into a catalogue without dependency cycles Failure/Error: it { is_expected.to compile.with_all_deps } error during compilation: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)

Check failure on line 13 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-8-x86_64 is expected to compile into a catalogue without dependency cycles Failure/Error: it { is_expected.to compile.with_all_deps } error during compilation: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)
it { is_expected.to contain_package('java').with(name: 'java-11-openjdk-headless', ensure: 'present') }

Check failure on line 14 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on centos-9-x86_64 is expected to contain Package[java] with name => "java-11-openjdk-headless" and ensure => "present" Failure/Error: it { is_expected.to contain_package('java').with(name: 'java-11-openjdk-headless', ensure: 'present') } expected that the catalogue would contain Package[java] with name set to "java-11-openjdk-headless" but it is set to "java-11-openjdk"

Check failure on line 14 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-9-x86_64 is expected to contain Package[java] with name => "java-11-openjdk-headless" and ensure => "present" Failure/Error: it { is_expected.to contain_package('java').with(name: 'java-11-openjdk-headless', ensure: 'present') } expected that the catalogue would contain Package[java] with name set to "java-11-openjdk-headless" but it is set to "java-11-openjdk"

Check failure on line 14 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-8-x86_64 is expected to contain Package[java] with name => "java-11-openjdk-headless" and ensure => "present" Failure/Error: it { is_expected.to contain_package('java').with(name: 'java-11-openjdk-headless', ensure: 'present') } expected that the catalogue would contain Package[java] with name set to "java-11-openjdk-headless" but it is set to "java-11-openjdk"
it { is_expected.to contain_alternatives('java').with(path: 'java-11-openjdk.x86_64') }
it { is_expected.to contain_alternatives('java').that_requires('Package[java]') }

Check failure on line 16 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on centos-9-x86_64 is expected to contain Alternatives[java] that requires Package[java] Failure/Error: raise ArgumentError, 'path must be a fully qualified path' unless (absolute_path? path) || (Facter.value('os.family') == 'RedHat') Puppet::ResourceError: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)

Check failure on line 16 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-9-x86_64 is expected to contain Alternatives[java] that requires Package[java] Failure/Error: raise ArgumentError, 'path must be a fully qualified path' unless (absolute_path? path) || (Facter.value('os.family') == 'RedHat') Puppet::ResourceError: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)

Check failure on line 16 in spec/classes/profile_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

example::profile_java on almalinux-8-x86_64 is expected to contain Alternatives[java] that requires Package[java] Failure/Error: raise ArgumentError, 'path must be a fully qualified path' unless (absolute_path? path) || (Facter.value('os.family') == 'RedHat') Puppet::ResourceError: Parameter path failed on Alternatives[java]: path must be a fully qualified path (file: /home/runner/work/puppet-example/puppet-example/spec/fixtures/modules/example/manifests/profile_java.pp, line: 13)
end
end
end
Loading