Merge "Add defined type to manage plugin packages"

This commit is contained in:
Zuul 2023-11-15 16:46:47 +00:00 committed by Gerrit Code Review
commit 9aa46d3292
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