Add defined type to manage plugin packages

Sahara has separate plugin packages according to the software used in
the data processing cluster, and in Ubuntu we have to install
the required plugin packages additionally.

This introduces the defined resource type which can be used to manage
plugin packages.

Change-Id: I224a5e32bd20aa86e14d738efd80d88ff9505a39
This commit is contained in:
Takashi Kajinami 2023-11-10 20:54:23 +09:00
parent 743331c9f4
commit 1445e3aca7
4 changed files with 62 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class sahara::params {
$engine_service_name = 'openstack-sahara-engine'
$sahara_wsgi_script_path = '/var/www/cgi-bin/sahara'
$sahara_wsgi_script_source = '/usr/bin/sahara-wsgi-api'
$plugin_package_name_base = 'python3-sahara-plugin-'
}
'Debian': {
$common_package_name = 'sahara-common'
@ -27,6 +28,7 @@ class sahara::params {
$engine_service_name = 'sahara-engine'
$sahara_wsgi_script_path = '/usr/lib/cgi-bin/sahara'
$sahara_wsgi_script_source = '/usr/bin/sahara-wsgi-api'
$plugin_package_name_base = 'python3-sahara-plugin-'
}
default: {
fail("Unsupported osfamily: ${facts['os']['family']}")

23
manifests/plugin.pp Normal file
View File

@ -0,0 +1,23 @@
# == Define: sahara::plugin
#
# Sahara plugin configuration
#
# === Parameters
#
# [*package_ensure*]
# (Optional) Ensure state for package
# Defaults to 'present'.
#
define sahara::plugin(
$package_ensure = 'present',
) {
include sahara::deps
include sahara::params
package { "sahara-plugin-${name}":
ensure => $package_ensure,
name => "${::sahara::params::plugin_package_name_base}${name}",
tag => ['openstack', 'sahara-package'],
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``sahara::plugin`` defined resource type has been added. This can
be used to manage plugin packages.

View File

@ -0,0 +1,32 @@
require 'spec_helper'
describe 'sahara::plugin' do
let(:title) {'vanilla'}
shared_examples_for 'sahara::plugin' do
context 'with default parameters' do
it 'installs the plugin package' do
is_expected.to contain_package('sahara-plugin-vanilla').with(
:ensure => 'present',
:name => 'python3-sahara-plugin-vanilla',
:tag => ['openstack', 'sahara-package'],
)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'sahara::plugin'
end
end
end