Add config option to override hardcoded service username

'manila' username is hardcoded and cannot be overridden. At
the moment the main purpose of this is to allow operator to
configure an username that can match manila charm's service
credential, which may be "manila", "manila_manilav2" or
"<prefix>-manila".

Related-bug: #2043588
Change-Id: I7bcdcd361b633481bd401209a1df614132d34139
This commit is contained in:
Rodrigo Barbieri 2023-12-01 12:00:03 -03:00
parent 47eef5da82
commit ed1b52eaf1
3 changed files with 19 additions and 4 deletions

View File

@ -30,6 +30,10 @@ options:
description: |
A comma-separated list of nagios servicegroups. If left empty, the
nagios_context will be used as the servicegroup.
service-user:
default: manila
type: string
description: Username used for keystone's service credential.
rabbit-user:
default: manila
type: string

View File

@ -7,7 +7,10 @@ import charms_openstack.charm as charm
import charms.reactive.relations as relations
import charmhelpers.core as ch_core
from charmhelpers.core.hookenv import log
from charmhelpers.core.hookenv import (
log,
config,
)
charms_openstack.bus.discover()
@ -41,12 +44,18 @@ def setup_manila():
}
@reactive.when('config.changed.service-user')
@reactive.when('identity-service.connected')
def update_ident_username(keystone):
"""Updates the user to the Identity Service"""
configure_ident_username(keystone)
@reactive.when_not('identity-service.available')
@reactive.when('identity-service.connected')
def configure_ident_username(keystone):
"""Requests a user to the Identity Service
"""
username = 'manila'
"""Requests a user to the Identity Service"""
username = config().get('service-user')
keystone.request_credentials(username)

View File

@ -50,6 +50,8 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
'ganesha-pool-configured',),
'disable_services': ('cluster.connected',),
'configure_nrpe': ('nrpe-external-master.available',),
'update_ident_username': ('config.changed.service-user',
'identity-service.connected',),
},
'when_not': {
'ceph_connected': ('ganesha-pool-configured',),