mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
replica promotion: check domain level before ipaservers membership
Check domain level before checking ipaservers membership to prevent "not found" error when attempting replica promotion in domain level 0. https://fedorahosted.org/freeipa/ticket/5401 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
@@ -975,6 +975,20 @@ def promote_check(installer):
|
||||
replman = ReplicationManager(config.realm_name,
|
||||
config.master_host_name, None)
|
||||
|
||||
# Detect the current domain level
|
||||
try:
|
||||
current = remote_api.Command['domainlevel_get']()['result']
|
||||
except errors.NotFound:
|
||||
# If we're joining an older master, domain entry is not
|
||||
# available
|
||||
current = constants.DOMAIN_LEVEL_0
|
||||
|
||||
if current == constants.DOMAIN_LEVEL_0:
|
||||
raise RuntimeError(
|
||||
"You must provide a file generated by ipa-replica-prepare to "
|
||||
"create a replica when the domain is at level 0."
|
||||
)
|
||||
|
||||
# Check authorization
|
||||
result = remote_api.Command['hostgroup_find'](
|
||||
cn=u'ipaservers',
|
||||
@@ -1029,20 +1043,6 @@ def promote_check(installer):
|
||||
config.host_name)
|
||||
sys.exit(3)
|
||||
|
||||
# Detect the current domain level
|
||||
try:
|
||||
current = remote_api.Command['domainlevel_get']()['result']
|
||||
except errors.NotFound:
|
||||
# If we're joining an older master, domain entry is not
|
||||
# available
|
||||
current = constants.DOMAIN_LEVEL_0
|
||||
|
||||
if current == constants.DOMAIN_LEVEL_0:
|
||||
raise RuntimeError(
|
||||
"You must provide a file generated by ipa-replica-prepare to "
|
||||
"create a replica when the domain is at level 0."
|
||||
)
|
||||
|
||||
# Detect if current level is out of supported range
|
||||
# for this IPA version
|
||||
under_lower_bound = current < constants.MIN_DOMAIN_LEVEL
|
||||
|
||||
Reference in New Issue
Block a user