Make password in octavia::neutron class required

This makes the password parameter required in the octavia::neutron
class and also mentions that its a required class for Octavia to work
correctly.

Depends-On: https://review.opendev.org/941595
Change-Id: Ic83ce7512077e0c5247222ec8214364954914b9b
This commit is contained in:
Tobias Urdin
2025-02-13 21:04:39 +01:00
committed by Takashi Kajinami
parent 4598e03711
commit e5e9a77646
3 changed files with 23 additions and 16 deletions

View File

@@ -4,6 +4,9 @@
#
# === Parameters:
#
# [*password*]
# (Required) Password for user
#
# [*auth_url*]
# (Optional) Keystone Authentication URL
# Defaults to 'http://localhost:5000'
@@ -12,10 +15,6 @@
# (Optional) User for accessing neutron
# Defaults to 'neutron'
#
# [*password*]
# (Optional) Password for user. This will be required in a future release.
# Defaults to $facts['os_service_default']
#
# [*project_name*]
# (Optional) Tenant for accessing neutron
# Defaults to 'services'
@@ -53,9 +52,9 @@
# Defaults to $facts['os_service_default']
#
class octavia::neutron (
$password,
$auth_url = 'http://localhost:5000',
$username = 'neutron',
$password = $facts['os_service_default'],
$project_name = 'services',
$user_domain_name = 'Default',
$project_domain_name = 'Default',
@@ -69,10 +68,6 @@ class octavia::neutron (
include octavia::deps
if is_service_default($password) {
warning('[neutron] section will require valid credential options in a future release')
}
if is_service_default($system_scope) {
$project_name_real = $project_name
$project_domain_name_real = $project_domain_name

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
The ``octavia::neutron`` class is now required and atleast the ``password``
should be configured but you should verify that ``auth_url`` and other
parameters is specified correctly.

View File

@@ -2,11 +2,17 @@ require 'spec_helper'
describe 'octavia::neutron' do
shared_examples 'octavia::neutron' do
let :params do
{
:password => 'secret',
}
end
context 'with default parameters' do
it {
is_expected.to contain_octavia_config('neutron/auth_url').with_value('http://localhost:5000')
is_expected.to contain_octavia_config('neutron/username').with_value('neutron')
is_expected.to contain_octavia_config('neutron/password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_octavia_config('neutron/password').with_value('secret').with_secret(true)
is_expected.to contain_octavia_config('neutron/project_name').with_value('services')
is_expected.to contain_octavia_config('neutron/user_domain_name').with_value('Default')
is_expected.to contain_octavia_config('neutron/project_domain_name').with_value('Default')
@@ -20,8 +26,8 @@ describe 'octavia::neutron' do
end
context 'with specified parameters' do
let :params do
{
before do
params.merge!({
:auth_url => 'http://127.0.0.1:5000',
:username => 'some_user',
:password => 'secrete',
@@ -33,7 +39,7 @@ describe 'octavia::neutron' do
:service_name => 'networking',
:endpoint_override => 'http://127.0.0.1:9696',
:valid_interfaces => ['internal', 'public'],
}
})
end
it {
@@ -53,10 +59,10 @@ describe 'octavia::neutron' do
end
context 'when system_scope is set' do
let :params do
{
before do
params.merge!({
:system_scope => 'all'
}
})
end
it 'configures system-scoped credential' do
is_expected.to contain_octavia_config('neutron/project_domain_name').with_value('<SERVICE DEFAULT>')