Merge "Drop redundant defaults for serial console options"

This commit is contained in:
Zuul 2025-01-05 22:13:56 +00:00 committed by Gerrit Code Review
commit 6d0d814893
4 changed files with 55 additions and 29 deletions

View File

@ -6,21 +6,21 @@
#
# [*port_range*]
# (optional) Range of TCP ports to use for serial ports on compute hosts
# Defaults to 10000:20000
# Defaults to $facts['os_service_default']
#
# [*base_url*]
# (optional) URL that gets passed to the clients
# Defaults to 'ws://127.0.0.1:6083/'
# Defaults to $facts['os_service_default']
#
# [*proxyclient_address*]
# The address to which proxy clients (like nova-serialproxy)
# should connect (string value)
# Defaults to 127.0.0.1
# Defaults to $facts['os_service_default']
#
class nova::compute::serial(
$port_range = '10000:20000',
$base_url = 'ws://127.0.0.1:6083/',
$proxyclient_address = '127.0.0.1',
$port_range = $facts['os_service_default'],
$base_url = $facts['os_service_default'],
$proxyclient_address = $facts['os_service_default'],
) {
include nova::deps

View File

@ -14,11 +14,11 @@
#
# [*serialproxy_host*]
# (optional) Host on which to listen for incoming requests
# Defaults to '0.0.0.0'
# Defaults to $facts['os_service_default']
#
# [*serialproxy_port*]
# (optional) Port on which to listen for incoming requests
# Defaults to '6083'
# Defaults to $facts['os_service_default']
#
# [*ensure_package*]
# (optional) The state of the nova-serialproxy package
@ -27,8 +27,8 @@
class nova::serialproxy(
Boolean $enabled = true,
Boolean $manage_service = true,
$serialproxy_host = '0.0.0.0',
$serialproxy_port = '6083',
$serialproxy_host = $facts['os_service_default'],
$serialproxy_port = $facts['os_service_default'],
$ensure_package = 'present'
) {

View File

@ -2,19 +2,30 @@ require 'spec_helper'
describe 'nova::compute::serial' do
shared_examples 'nova::compute::serial' do
it { should contain_nova_config('serial_console/enabled').with_value('true') }
it { should contain_nova_config('serial_console/port_range').with_value('10000:20000')}
it { should contain_nova_config('serial_console/base_url').with_value('ws://127.0.0.1:6083/')}
it { should contain_nova_config('serial_console/proxyclient_address').with_value('127.0.0.1')}
context 'with defaults' do
it 'configures defaults' do
should contain_nova_config('serial_console/enabled').with_value('true')
should contain_nova_config('serial_console/port_range').with_value('<SERVICE DEFAULT>')
should contain_nova_config('serial_console/base_url').with_value('<SERVICE DEFAULT>')
should contain_nova_config('serial_console/proxyclient_address').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding params' do
let :params do
{
:proxyclient_address => '10.10.10.10',
:port_range => '10000:20000',
:base_url => 'ws://127.0.0.1:6083/',
:proxyclient_address => '127.0.0.1',
}
end
it { should contain_nova_config('serial_console/proxyclient_address').with_value('10.10.10.10')}
it 'configures the parameters' do
should contain_nova_config('serial_console/enabled').with_value('true')
should contain_nova_config('serial_console/port_range').with_value('10000:20000')
should contain_nova_config('serial_console/base_url').with_value('ws://127.0.0.1:6083/')
should contain_nova_config('serial_console/proxyclient_address').with_value('127.0.0.1')
end
end
end

View File

@ -12,21 +12,36 @@ describe 'nova::serialproxy' do
shared_examples 'nova-serialproxy' do
it 'configures nova.conf' do
is_expected.to contain_nova_config('serial_console/serialproxy_host').with(:value => '0.0.0.0')
is_expected.to contain_nova_config('serial_console/serialproxy_port').with(:value => '6083')
context 'with defaults' do
it 'configures nova.conf' do
is_expected.to contain_nova_config('serial_console/serialproxy_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('serial_console/serialproxy_port').with_value('<SERVICE DEFAULT>')
end
it { is_expected.to contain_package('nova-serialproxy').with(
:name => platform_params[:serialproxy_package_name],
:ensure => 'present'
)}
it { is_expected.to contain_service('nova-serialproxy').with(
:name => platform_params[:serialproxy_service_name],
:hasstatus => 'true',
:ensure => 'running'
)}
end
it { is_expected.to contain_package('nova-serialproxy').with(
:name => platform_params[:serialproxy_package_name],
:ensure => 'present'
) }
it { is_expected.to contain_service('nova-serialproxy').with(
:name => platform_params[:serialproxy_service_name],
:hasstatus => 'true',
:ensure => 'running'
)}
context 'with parameters' do
let :params do
{
:serialproxy_host => '0.0.0.0',
:serialproxy_port => 6083
}
end
it 'configures nova.conf' do
is_expected.to contain_nova_config('serial_console/serialproxy_host').with_value('0.0.0.0')
is_expected.to contain_nova_config('serial_console/serialproxy_port').with_value(6083)
end
end
context 'with manage_service as false' do
let :params do