Add consoleauth option support

Change-Id: Ic77b0a4aa0715344ed32c74cc11c114a6232af73
This commit is contained in:
Takashi Kajinami 2024-04-04 09:29:59 +09:00
parent c990ec28c3
commit 83c9e4b17b
3 changed files with 69 additions and 0 deletions

26
manifests/consoleauth.pp Normal file
View File

@ -0,0 +1,26 @@
# == Class: nova::consoleauth
#
# Configure the consoleauth options
#
# === Parameters
#
# [*token_ttl*]
# (Optional) The lifetime of a console auth token (in seconds).
# Defaults to $facts['os_service_default'].
#
# [*enforce_session_timeout*]
# (Optional) Enable ot disable enforce session timeout for VM console.
# Defaults to $facts['os_service_default'].
#
class nova::consoleauth (
$token_ttl = $facts['os_service_default'],
$enforce_session_timeout = $facts['os_service_default'],
) {
include nova::deps
nova_config {
'consoleauth/token_ttl': value => $token_ttl;
'consoleauth/enforce_session_timeout': value => $enforce_session_timeout;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``nova::consoleauth`` class has been added.

View File

@ -0,0 +1,39 @@
require 'spec_helper'
describe 'nova::consoleauth' do
shared_examples 'nova::consoleauth' do
context 'with defaults' do
it 'configures consoleauth in nova.conf' do
should contain_nova_config('consoleauth/token_ttl').with_value('<SERVICE DEFAULT>')
should contain_nova_config('consoleauth/enforce_session_timeout').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters' do
let :params do
{
:token_ttl => 600,
:enforce_session_timeout => false,
}
end
it 'configures consoleauth in nova.conf' do
should contain_nova_config('consoleauth/token_ttl').with_value(600)
should contain_nova_config('consoleauth/enforce_session_timeout').with_value(false)
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_behaves_like 'nova::consoleauth'
end
end
end