Skip to content

Commit

Permalink
Configurable kcadm config delay
Browse files Browse the repository at this point in the history
This patch makes a configuration delay more flexible to avoid
unnecessary long delays on more powerful machines.

The delay can now be set using OVE property ie.

engine-setup   --otopi-environment="OVESETUP_KEYCLOAK_CONFIG/configDelaySeconds=int:5"

Signed-off-by: Artur Socha <[email protected]>
  • Loading branch information
arso committed Apr 20, 2022
1 parent c0c4e36 commit b36de55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packaging/setup/ovirt_engine_setup/keycloak/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class Const(object):
KEYCLOAK_CLI_ADMIN_SCRIPT = 'kcadm.sh'
OVIRT_ENGINE_KEYCLOAK_PACKAGE_NAME = 'ovirt-engine-keycloak'
OVIRT_ENGINE_KEYCLOAK_SETUP_PACKAGE_NAME = 'ovirt-engine-keycloak-setup'
OVIRT_ENGINE_KEYCLOAK_CONFIG_DELAY_SECONDS = 10

@classproperty
def KEYCLOAK_DB_ENV_KEYS(self):
Expand Down Expand Up @@ -176,6 +177,9 @@ class CoreEnv(object):
def ENABLE(self):
return 'OVESETUP_KEYCLOAK_CORE/enable'

OVIRT_ENGINE_KEYCLOAK_CONFIG_DELAY = 'OVESETUP_KEYCLOAK_CONFIG/configDelaySeconds'


@util.export
@util.codegen
@osetupattrsclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@ class Plugin(plugin.PluginBase):
"""Ovirt engine keycloak internal sso realm configuration plugin."""

KCADM_ENV = {
'KC_OPTS':'-Dcom.redhat.fips=false'
'KC_OPTS': '-Dcom.redhat.fips=false'
}

def __init__(self, context):
super(Plugin, self).__init__(context=context)

@plugin.event(
stage=plugin.Stages.STAGE_INIT,
)
def _init(self):
self.environment.setdefault(
okkcons.CoreEnv.OVIRT_ENGINE_KEYCLOAK_CONFIG_DELAY,
okkcons.Const.OVIRT_ENGINE_KEYCLOAK_CONFIG_DELAY_SECONDS,
)

@plugin.event(
stage=plugin.Stages.STAGE_SETUP,
)
Expand Down Expand Up @@ -74,7 +83,9 @@ def _setup_ovirt(self):
# TODO sometimes keycloak app is not ready soon enough resulting
# in 503 error on attempt to use kcadm.sh / api
# This sleep is only a workaround until better way is found
time.sleep(30)
time.sleep(self.environment[
okkcons.CoreEnv.OVIRT_ENGINE_KEYCLOAK_CONFIG_DELAY
])

self._setup_keystore()

Expand Down

0 comments on commit b36de55

Please sign in to comment.