Skip to content

Commit

Permalink
Merge branch 'broadinstitute-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
southalc committed Nov 26, 2024
2 parents 1189465 + 8cedef8 commit ca1b035
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 28 deletions.
11 changes: 10 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The following parameters are available in the `podman` class:
* [`podman_docker_pkg`](#-podman--podman_docker_pkg)
* [`compose_pkg`](#-podman--compose_pkg)
* [`machinectl_pkg`](#-podman--machinectl_pkg)
* [`podman_pkg_ensure`](#-podman--podman_pkg_ensure)
* [`buildah_pkg_ensure`](#-podman--buildah_pkg_ensure)
* [`podman_docker_pkg_ensure`](#-podman--podman_docker_pkg_ensure)
* [`compose_pkg_ensure`](#-podman--compose_pkg_ensure)
Expand Down Expand Up @@ -148,6 +149,14 @@ The name of the machinectl package (default 'systemd-container').

Default value: `'systemd-container'`

##### <a name="-podman--podman_pkg_ensure"></a>`podman_pkg_ensure`

Data type: `Pattern[/^(\d+\.){2}\d+$/, /absent/, /installed/]`

The ensure value for the podman package (default 'installed')

Default value: `'installed'`

##### <a name="-podman--buildah_pkg_ensure"></a>`buildah_pkg_ensure`

Data type: `Enum['absent', 'installed']`
Expand All @@ -166,7 +175,7 @@ Default value: `'installed'`

##### <a name="-podman--compose_pkg_ensure"></a>`compose_pkg_ensure`

Data type: `Enum['absent', 'installed']`
Data type: `Pattern[/^(\d+\.){2}\d+$/, /absent/, /installed/]`

The ensure value for the podman-compose package (default 'absent')

Expand Down
1 change: 0 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ podman::quadlet::defaults:
TimeoutStartSec: "180"
Install:
WantedBy: "multi-user.target default.target"

54 changes: 29 additions & 25 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# @param machinectl_pkg
# The name of the machinectl package (default 'systemd-container').
#
# @param podman_pkg_ensure
# The ensure value for the podman package (default 'installed')
#
# @param buildah_pkg_ensure
# The ensure value for the buildah package (default 'absent')
#
Expand Down Expand Up @@ -112,31 +115,32 @@
# - Podman::Volume[jenkins]
#
class podman (
String $podman_pkg = 'podman',
String $skopeo_pkg = 'skopeo',
String $buildah_pkg = 'buildah',
String $podman_docker_pkg = 'podman-docker',
String $compose_pkg = 'podman-compose',
String $machinectl_pkg = 'systemd-container',
Enum['absent', 'installed'] $buildah_pkg_ensure = 'absent',
Enum['absent', 'installed'] $podman_docker_pkg_ensure = 'installed',
Enum['absent', 'installed'] $compose_pkg_ensure = 'absent',
Enum['absent', 'installed'] $machinectl_pkg_ensure = 'installed',
Enum['absent', 'file'] $nodocker = 'absent',
Hash $storage_options = {},
Hash $containers_options = {},
Array $rootless_users = [],
Boolean $enable_api_socket = false,
Boolean $manage_subuid = false,
Boolean $match_subuid_subgid = true,
String $file_header = '# FILE MANAGED BY PUPPET',
Hash $subid = {},
Hash $pods = {},
Hash $volumes = {},
Hash $images = {},
Hash $containers = {},
Hash $networks = {},
Hash $quadlets = {},
String $podman_pkg = 'podman',
String $skopeo_pkg = 'skopeo',
String $buildah_pkg = 'buildah',
String $podman_docker_pkg = 'podman-docker',
String $compose_pkg = 'podman-compose',
String $machinectl_pkg = 'systemd-container',
Pattern[/^(\d+\.){2}\d+$/, /absent/, /installed/] $podman_pkg_ensure = 'installed',
Enum['absent', 'installed'] $buildah_pkg_ensure = 'absent',
Enum['absent', 'installed'] $podman_docker_pkg_ensure = 'installed',
Pattern[/^(\d+\.){2}\d+$/, /absent/, /installed/] $compose_pkg_ensure = 'absent',
Enum['absent', 'installed'] $machinectl_pkg_ensure = 'installed',
Enum['absent', 'file'] $nodocker = 'absent',
Hash $storage_options = {},
Hash $containers_options = {},
Array $rootless_users = [],
Boolean $enable_api_socket = false,
Boolean $manage_subuid = false,
Boolean $match_subuid_subgid = true,
String $file_header = '# FILE MANAGED BY PUPPET',
Hash $subid = {},
Hash $pods = {},
Hash $volumes = {},
Hash $images = {},
Hash $containers = {},
Hash $networks = {},
Hash $quadlets = {},
) {
include podman::install
include podman::options
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @api private
#
class podman::install {
ensure_resource('Package', $podman::podman_pkg, { 'ensure' => 'installed' })
ensure_resource('Package', $podman::podman_pkg, { 'ensure' => $podman::podman_pkg_ensure })
ensure_resource('Package', $podman::skopeo_pkg, { 'ensure' => 'installed' })
ensure_resource('Package', $podman::buildah_pkg, { 'ensure' => $podman::buildah_pkg_ensure })
ensure_resource('Package', $podman::podman_docker_pkg, { 'ensure' => $podman::podman_docker_pkg_ensure })
Expand Down
17 changes: 17 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@
it { is_expected.to contain_package('testing') }
end

context 'with podman_pkg_ensure set to valid installed' do
let(:params) { { podman_pkg_ensure: 'installed' } } # parameter used in podman::install

it { is_expected.to contain_package('podman').with_ensure('installed') }
end

context 'with podman_pkg_ensure set to valid version 1.0.0' do
let(:params) { { podman_pkg_ensure: '1.0.0' } } # parameter used in podman::install

it { is_expected.to contain_package('podman').with_ensure('1.0.0') }
end

context 'with buildah_pkg_ensure set to valid installed' do
let(:params) { { buildah_pkg_ensure: 'installed' } } # parameter used in podman::install

Expand All @@ -101,6 +113,11 @@

it { is_expected.to contain_package('podman-compose').with_ensure('installed') }
end
context 'with compose_pkg_ensure set to valid version 1.0.0' do
let(:params) { { compose_pkg_ensure: '1.0.0' } } # parameter used in podman::install

it { is_expected.to contain_package('podman-compose').with_ensure('1.0.0') }
end
context 'with machinectl_pkg_ensure set to valid absent' do
let(:params) { { machinectl_pkg_ensure: 'absent' } } # parameter used in podman::install

Expand Down

0 comments on commit ca1b035

Please sign in to comment.