Switch for Keystone DB cron job
Adds parameter to enable switching off token flush cron job. Partial-bug: rhbz#1249106 Depends-On: I5e51562338f68b4ba1b2e942907e6f6a0ab7a61e Change-Id: If358a096e9880b7564b59072829c52b3a63f82c9
This commit is contained in:
@@ -291,6 +291,9 @@ Keystone Config parameters
|
|||||||
**CONFIG_KEYSTONE_DB_PW**
|
**CONFIG_KEYSTONE_DB_PW**
|
||||||
Password to use for the Identity service (keystone) to access the database.
|
Password to use for the Identity service (keystone) to access the database.
|
||||||
|
|
||||||
|
**CONFIG_KEYSTONE_DB_PURGE_ENABLE**
|
||||||
|
Enter y if cron job for removing soft deleted DB rows should be created.
|
||||||
|
|
||||||
**CONFIG_KEYSTONE_REGION**
|
**CONFIG_KEYSTONE_REGION**
|
||||||
Default region name to use when creating tenants in the Identity service.
|
Default region name to use when creating tenants in the Identity service.
|
||||||
|
|
||||||
|
@@ -23,7 +23,8 @@ from .exceptions import ParamProcessingError
|
|||||||
|
|
||||||
|
|
||||||
__all__ = ('ParamProcessingError', 'process_cidr', 'process_host',
|
__all__ = ('ParamProcessingError', 'process_cidr', 'process_host',
|
||||||
'process_ssh_key')
|
'process_ssh_key', 'process_add_quotes_around_values',
|
||||||
|
'process_password', 'process_string_nofloat', 'process_bool')
|
||||||
|
|
||||||
|
|
||||||
def process_cidr(param, param_name, config=None):
|
def process_cidr(param, param_name, config=None):
|
||||||
@@ -135,3 +136,19 @@ def process_string_nofloat(param, param_name, config=None):
|
|||||||
return param
|
return param
|
||||||
else:
|
else:
|
||||||
param = uuid.uuid4().hex[:16]
|
param = uuid.uuid4().hex[:16]
|
||||||
|
|
||||||
|
|
||||||
|
def process_bool(param, param_name, config=None):
|
||||||
|
"""Converts param to appropriate boolean representation.
|
||||||
|
|
||||||
|
Retunrs True if answer == y|yes|true, False if answer == n|no|false.
|
||||||
|
"""
|
||||||
|
if param.lower() in ('y', 'yes', 'true'):
|
||||||
|
return True
|
||||||
|
elif param.lower() in ('n', 'no', 'false'):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# Define silent processors
|
||||||
|
for proc_func in (process_bool, process_add_quotes_around_values):
|
||||||
|
proc_func.silent = True
|
||||||
|
@@ -295,12 +295,13 @@ def process_param_value(param, value):
|
|||||||
_value = value
|
_value = value
|
||||||
proclist = param.PROCESSORS or []
|
proclist = param.PROCESSORS or []
|
||||||
for proc_func in proclist:
|
for proc_func in proclist:
|
||||||
|
is_silent = getattr(proc_func, 'silent', False)
|
||||||
logging.debug("Processing value of parameter "
|
logging.debug("Processing value of parameter "
|
||||||
"%s." % param.CONF_NAME)
|
"%s." % param.CONF_NAME)
|
||||||
try:
|
try:
|
||||||
new_value = proc_func(_value, param.CONF_NAME, controller.CONF)
|
new_value = proc_func(_value, param.CONF_NAME, controller.CONF)
|
||||||
if new_value != _value:
|
if new_value != _value:
|
||||||
if param.MASK_INPUT is False:
|
if param.MASK_INPUT is False and not is_silent:
|
||||||
msg = output_messages.INFO_CHANGED_VALUE
|
msg = output_messages.INFO_CHANGED_VALUE
|
||||||
print(msg % (_value, new_value))
|
print(msg % (_value, new_value))
|
||||||
_value = new_value
|
_value = new_value
|
||||||
|
@@ -50,6 +50,22 @@ def initConfig(controller):
|
|||||||
"NEED_CONFIRM": True,
|
"NEED_CONFIRM": True,
|
||||||
"CONDITION": False},
|
"CONDITION": False},
|
||||||
|
|
||||||
|
{"CMD_OPTION": 'keystone-db-purge-enable',
|
||||||
|
"PROMPT": (
|
||||||
|
"Enter y if cron job for removing soft deleted DB rows "
|
||||||
|
"should be created"
|
||||||
|
),
|
||||||
|
"OPTION_LIST": ['y', 'n'],
|
||||||
|
"VALIDATORS": [validators.validate_not_empty],
|
||||||
|
"PROCESSORS": [processors.process_bool],
|
||||||
|
"DEFAULT_VALUE": 'y',
|
||||||
|
"MASK_INPUT": False,
|
||||||
|
"LOOSE_VALIDATION": False,
|
||||||
|
"CONF_NAME": 'CONFIG_KEYSTONE_DB_PURGE_ENABLE',
|
||||||
|
"USE_DEFAULT": False,
|
||||||
|
"NEED_CONFIRM": True,
|
||||||
|
"CONDITION": False},
|
||||||
|
|
||||||
{"CMD_OPTION": "keystone-region",
|
{"CMD_OPTION": "keystone-region",
|
||||||
"PROMPT": "Region name",
|
"PROMPT": "Region name",
|
||||||
"OPTION_LIST": [],
|
"OPTION_LIST": [],
|
||||||
|
@@ -119,13 +119,16 @@ if hiera('CONFIG_KEYSTONE_IDENTITY_BACKEND') == 'ldap' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db_purge = hiera('CONFIG_KEYSTONE_DB_PURGE_ENABLE')
|
||||||
|
if $db_purge {
|
||||||
# Run token flush every minute (without output so we won't spam admins)
|
# Run token flush every minute (without output so we won't spam admins)
|
||||||
# Logs are available in /var/log/keystone/keystone-tokenflush.log
|
|
||||||
class { '::keystone::cron::token_flush':
|
class { '::keystone::cron::token_flush':
|
||||||
minute => '*/1',
|
minute => '*/1',
|
||||||
|
destination => '/dev/null',
|
||||||
require => [Service['crond'], User['keystone'], Group['keystone']]
|
require => [Service['crond'], User['keystone'], Group['keystone']]
|
||||||
}
|
}
|
||||||
service { 'crond':
|
service { 'crond':
|
||||||
ensure => 'running',
|
ensure => 'running',
|
||||||
enable => true,
|
enable => true,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -25,6 +25,7 @@ from packstack.modules import ospluginutils
|
|||||||
from packstack.modules import puppet
|
from packstack.modules import puppet
|
||||||
from packstack.installer import basedefs
|
from packstack.installer import basedefs
|
||||||
from packstack.installer import run_setup
|
from packstack.installer import run_setup
|
||||||
|
from packstack.installer import validators
|
||||||
|
|
||||||
from ..test_base import FakePopen
|
from ..test_base import FakePopen
|
||||||
from ..test_base import PackstackTestCaseMixin
|
from ..test_base import PackstackTestCaseMixin
|
||||||
@@ -37,6 +38,16 @@ def makefile(path, content):
|
|||||||
|
|
||||||
|
|
||||||
class CommandLineTestCase(PackstackTestCaseMixin, TestCase):
|
class CommandLineTestCase(PackstackTestCaseMixin, TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(CommandLineTestCase, self).setUp()
|
||||||
|
self._old_validate_ssh = validators.validate_ssh
|
||||||
|
validators.validate_ssh = lambda param, options=None: None
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(CommandLineTestCase, self).tearDown()
|
||||||
|
validators.validate_ssh = self._old_validate_ssh
|
||||||
|
|
||||||
def test_running_install_hosts(self):
|
def test_running_install_hosts(self):
|
||||||
"""
|
"""
|
||||||
Test packstack.installer.run_setup.main
|
Test packstack.installer.run_setup.main
|
||||||
|
Reference in New Issue
Block a user