Merge pull request #3906 from ssilvert/update-migration-scripts

KEYCLOAK-4514: Update migration scripts according to changes to the
This commit is contained in:
Stan Silvert 2017-03-01 15:54:57 -05:00 committed by GitHub
commit 89768ef003
6 changed files with 282 additions and 0 deletions

View file

@ -132,4 +132,71 @@ if (result == NONE) of /profile=$clusteredProfile/subsystem=infinispan/cache-con
echo echo
end-if end-if
# Migrate from 2.5.0 to 2.5.1
# NO CHANGES
# Migrate 2.5.1 to 2.5.4
if (result != REPEATABLE_READ) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:read-attribute(name=isolation)
echo Changing ejb cache locking to REPEATABLE_READ
/profile=$clusteredProfile/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:write-attribute(name=isolation,value=REPEATABLE_READ)
echo
end-if
if (outcome == success) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:read-resource
echo Removing Hibernate immutable-entity cache
/profile=$clusteredProfile/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:remove
end-if
# Migrate from 2.5.4 to 3.0.0
if (result == jpa) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=eventsStore/:read-attribute(name=default-provider,include-defaults=false)
echo Removing default provider for eventsStore
/profile=$clusteredProfile/subsystem=keycloak-server/spi=eventsStore/:undefine-attribute(name=default-provider)
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=realm/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=realm/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=user/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=user/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for userFederatedStorage SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=userFederatedStorage/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=authorizationPersister/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for authorizationPersister SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=authorizationPersister/:remove
echo
end-if
if (outcome == failed) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=userCache/:read-resource
echo Adding userCache SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=userCache/:add
/profile=$clusteredProfile/subsystem=keycloak-server/spi=userCache/provider=default/:add(enabled=true)
echo
end-if
if (outcome == failed) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=realmCache/:read-resource
echo Adding realmCache SPI
/profile=$clusteredProfile/subsystem=keycloak-server/spi=realmCache/:add
/profile=$clusteredProfile/subsystem=keycloak-server/spi=realmCache/provider=default/:add(enabled=true)
echo
end-if
if ((result.default-provider == undefined) && (result.provider.default.enabled == true)) of /subsystem=keycloak-server/spi=connectionsInfinispan/:read-resource(recursive=true,include-defaults=false)
echo Adding 'default' as default provider for connectionsInfinispan
/profile=$clusteredProfile/subsystem=keycloak-server/spi=connectionsInfinispan/:write-attribute(name=default-provider,value=default)
echo
end-if
echo *** End Migration of /profile=$clusteredProfile *** echo *** End Migration of /profile=$clusteredProfile ***

View file

@ -120,4 +120,71 @@ if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-co
echo echo
end-if end-if
# Migrate from 2.5.0 to 2.5.1
# NO CHANGES
# Migrate 2.5.1 to 2.5.4
if (result != REPEATABLE_READ) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:read-attribute(name=isolation)
echo Changing ejb cache locking to REPEATABLE_READ
/profile=$standaloneProfile/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:write-attribute(name=isolation,value=REPEATABLE_READ)
echo
end-if
if (outcome == success) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:read-resource
echo Removing Hibernate immutable-entity cache
/profile=$standaloneProfile/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:remove
end-if
# Migrate from 2.5.4 to 3.0.0
if (result == jpa) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=eventsStore/:read-attribute(name=default-provider,include-defaults=false)
echo Removing default provider for eventsStore
/profile=$standaloneProfile/subsystem=keycloak-server/spi=eventsStore/:undefine-attribute(name=default-provider)
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=user/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=user/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for userFederatedStorage SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=authorizationPersister/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for authorizationPersister SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=authorizationPersister/:remove
echo
end-if
if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userCache/:read-resource
echo Adding userCache SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=userCache/:add
/profile=$standaloneProfile/subsystem=keycloak-server/spi=userCache/provider=default/:add(enabled=true)
echo
end-if
if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realmCache/:read-resource
echo Adding realmCache SPI
/profile=$standaloneProfile/subsystem=keycloak-server/spi=realmCache/:add
/profile=$standaloneProfile/subsystem=keycloak-server/spi=realmCache/provider=default/:add(enabled=true)
echo
end-if
if ((result.default-provider == undefined) && (result.provider.default.enabled == true)) of /subsystem=keycloak-server/spi=connectionsInfinispan/:read-resource(recursive=true,include-defaults=false)
echo Adding 'default' as default provider for connectionsInfinispan
/profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsInfinispan/:write-attribute(name=default-provider,value=default)
echo
end-if
echo *** End Migration of /profile=$standaloneProfile *** echo *** End Migration of /profile=$standaloneProfile ***

View file

@ -137,4 +137,70 @@ if (result == NONE) of /subsystem=infinispan/cache-container=keycloak/local-cach
echo echo
end-if end-if
# Migrate from 2.5.0 to 2.5.1
# NO CHANGES
# Migrate 2.5.1 to 2.5.4
if (result != REPEATABLE_READ) of /subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:read-attribute(name=isolation)
echo Changing ejb cache locking to REPEATABLE_READ
/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:write-attribute(name=isolation,value=REPEATABLE_READ)
echo
end-if
if (outcome == success) of /subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:read-resource
echo Removing Hibernate immutable-entity cache
/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:remove
end-if
# Migrate from 2.5.4 to 3.0.0
if (result == jpa) of /subsystem=keycloak-server/spi=eventsStore/:read-attribute(name=default-provider,include-defaults=false)
echo Removing default provider for eventsStore
/subsystem=keycloak-server/spi=eventsStore/:undefine-attribute(name=default-provider)
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=realm/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/subsystem=keycloak-server/spi=realm/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=user/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/subsystem=keycloak-server/spi=user/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=userFederatedStorage/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for userFederatedStorage SPI
/subsystem=keycloak-server/spi=userFederatedStorage/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=authorizationPersister/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for authorizationPersister SPI
/subsystem=keycloak-server/spi=authorizationPersister/:remove
echo
end-if
if (outcome == failed) of /subsystem=keycloak-server/spi=userCache/:read-resource
echo Adding userCache SPI
/subsystem=keycloak-server/spi=userCache/:add
/subsystem=keycloak-server/spi=userCache/provider=default/:add(enabled=true)
echo
end-if
if (outcome == failed) of /subsystem=keycloak-server/spi=realmCache/:read-resource
echo Adding realmCache SPI
/subsystem=keycloak-server/spi=realmCache/:add
/subsystem=keycloak-server/spi=realmCache/provider=default/:add(enabled=true)
echo
end-if
if ((result.default-provider == undefined) && (result.provider.default.enabled == true)) of /subsystem=keycloak-server/spi=connectionsInfinispan/:read-resource(recursive=true,include-defaults=false)
echo Adding 'default' as default provider for connectionsInfinispan
/subsystem=keycloak-server/spi=connectionsInfinispan/:write-attribute(name=default-provider,value=default)
echo
end-if
echo *** End Migration *** echo *** End Migration ***

View file

@ -39,6 +39,7 @@ if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/local
echo Updating authorization cache container.. echo Updating authorization cache container..
/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU) /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU)
/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100) /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100)
echo
end-if end-if
# Migrate from 2.0.0 to 2.1.0 # Migrate from 2.0.0 to 2.1.0
@ -127,4 +128,71 @@ if (result == NONE) of /subsystem=infinispan/cache-container=keycloak/local-cach
echo echo
end-if end-if
# Migrate from 2.5.0 to 2.5.1
# NO CHANGES
# Migrate 2.5.1 to 2.5.4
if (result != REPEATABLE_READ) of /subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:read-attribute(name=isolation)
echo Changing ejb cache locking to REPEATABLE_READ
/subsystem=infinispan/cache-container=ejb/local-cache=persistent/component=locking/:write-attribute(name=isolation,value=REPEATABLE_READ)
echo
end-if
if (outcome == success) of /subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:read-resource
echo Removing Hibernate immutable-entity cache
/subsystem=infinispan/cache-container=hibernate/local-cache=immutable-entity/:remove
end-if
# Migrate from 2.5.4 to 3.0.0
if (result == jpa) of /subsystem=keycloak-server/spi=eventsStore/:read-attribute(name=default-provider,include-defaults=false)
echo Removing default provider for eventsStore
/subsystem=keycloak-server/spi=eventsStore/:undefine-attribute(name=default-provider)
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=realm/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/subsystem=keycloak-server/spi=realm/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=user/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for user SPI
/subsystem=keycloak-server/spi=user/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=userFederatedStorage/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for userFederatedStorage SPI
/subsystem=keycloak-server/spi=userFederatedStorage/:remove
echo
end-if
if ((outcome == success) && (result.default-provider == jpa) && (result.provider == undefined)) of /subsystem=keycloak-server/spi=authorizationPersister/:read-resource(recursive=false,include-defaults=false)
echo Removing declaration for authorizationPersister SPI
/subsystem=keycloak-server/spi=authorizationPersister/:remove
echo
end-if
if (outcome == failed) of /subsystem=keycloak-server/spi=userCache/:read-resource
echo Adding userCache SPI
/subsystem=keycloak-server/spi=userCache/:add
/subsystem=keycloak-server/spi=userCache/provider=default/:add(enabled=true)
echo
end-if
if (outcome == failed) of /subsystem=keycloak-server/spi=realmCache/:read-resource
echo Adding realmCache SPI
/subsystem=keycloak-server/spi=realmCache/:add
/subsystem=keycloak-server/spi=realmCache/provider=default/:add(enabled=true)
echo
end-if
if ((result.default-provider == undefined) && (result.provider.default.enabled == true)) of /subsystem=keycloak-server/spi=connectionsInfinispan/:read-resource(recursive=true,include-defaults=false)
echo Adding 'default' as default provider for connectionsInfinispan
/subsystem=keycloak-server/spi=connectionsInfinispan/:write-attribute(name=default-provider,value=default)
echo
end-if
echo *** End Migration *** echo *** End Migration ***

View file

@ -1,6 +1,12 @@
# IMPORTANT: If you change this file you should also make equivalent changes # IMPORTANT: If you change this file you should also make equivalent changes
# to src/main/resources/cli/default-keycloak-subsys-config.cli # to src/main/resources/cli/default-keycloak-subsys-config.cli
# The CLI file is packaged with the subsystem and extracted by the overlay distribution. # The CLI file is packaged with the subsystem and extracted by the overlay distribution.
#
# Also, you should update the migrate-*.cli scripts in
# <keycloak>/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin
#
# Furthermore, you should run the tests in
# <keycloak>/testsuite/integration-arquillian/tests/other/server-config-migration
keycloak.server.subsys.default.config=\ keycloak.server.subsys.default.config=\
<subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">\ <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">\

View file

@ -0,0 +1,8 @@
Subsystem Config Files
========
IMPORTANT: If you change files in this directory you should also update the migrate-*.cli scripts in
`<keycloak>/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin`
Furthermore, you should run the tests in
`<keycloak>/testsuite/integration-arquillian/tests/other/server-config-migration`